Skip to content

Commit

Permalink
fixes #6 Remove 'heads/origin' prefix from docker tags
Browse files Browse the repository at this point in the history
  • Loading branch information
dkapanidis committed Jun 12, 2015
1 parent 7b3bd1c commit a71c655
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions captain/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package captain // import "github.com/harbur/captain/captain"

import (
"strings"
"regexp"
)

func getRevision() string {
Expand All @@ -10,7 +11,14 @@ func getRevision() string {

func getBranch() string {
branch := oneliner("git", "rev-parse", "--abbrev-ref", "HEAD")

// Remove start of "heads/origin" if exist
r := regexp.MustCompile("^heads\\/origin\\/")
branch = r.ReplaceAllString(branch, "")

// Replace all "/" with "."
branch = strings.Replace(branch, "/", ".", -1)

return branch
}

Expand Down

0 comments on commit a71c655

Please sign in to comment.