Skip to content

Commit

Permalink
Add some debug to get branch name
Browse files Browse the repository at this point in the history
  • Loading branch information
plorenz committed Nov 16, 2020
1 parent eccb9d8 commit 0ad6c54
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ func (cmd *BaseCommand) GetCurrentBranch() string {
branchName = cmd.GetCmdOutputOneLine("get git branch (rev-parse)", "git", "rev-parse", "--abbrev-ref", "HEAD")
if branchName == "HEAD" {
branchName = cmd.GetCmdOutputOneLine("get git branch (name-rev)", "git", "name-rev", "--name-only", "HEAD")
cmd.Infof("git name-rev returned %v\n", branchName)
if strings.HasPrefix(branchName, "/remotes/origin/") {
branchName = strings.TrimPrefix(branchName, "/remotes/origin/")
}
}
}
cmd.CurrentBranch = &branchName
Expand Down

0 comments on commit 0ad6c54

Please sign in to comment.