summaryrefslogtreecommitdiffstats
path: root/pkg/git
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-08-15 09:42:02 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-08-15 09:42:02 +1000
commit922f4ed5a42123af0e4b74030273429f9fbaa43a (patch)
treeb20bf81e303de78baefb61cc6b2032f15d0b03e7 /pkg/git
parent652237d48fabc401d795e9703c12fd37e2ec478e (diff)
try rev-parse of git symbolic-ref returns nothing
Diffstat (limited to 'pkg/git')
-rw-r--r--pkg/git/branch_list_builder.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/git/branch_list_builder.go b/pkg/git/branch_list_builder.go
index 41e59c093..e4a8461b8 100644
--- a/pkg/git/branch_list_builder.go
+++ b/pkg/git/branch_list_builder.go
@@ -39,7 +39,10 @@ func (b *BranchListBuilder) obtainCurrentBranch() commands.Branch {
// even though you're on 'master'
branchName, err := b.GitCommand.OSCommand.RunCommandWithOutput("git symbolic-ref --short HEAD")
if err != nil {
- panic(err.Error())
+ branchName, err = b.GitCommand.OSCommand.RunCommandWithOutput("git rev-parse --short HEAD")
+ if err != nil {
+ panic(err.Error())
+ }
}
return commands.Branch{Name: strings.TrimSpace(branchName), Recency: " *"}
}