summaryrefslogtreecommitdiffstats
path: root/pkg/git/branch_list_builder.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/git/branch_list_builder.go')
-rw-r--r--pkg/git/branch_list_builder.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/pkg/git/branch_list_builder.go b/pkg/git/branch_list_builder.go
index 151e5b0b4..821f7b9b1 100644
--- a/pkg/git/branch_list_builder.go
+++ b/pkg/git/branch_list_builder.go
@@ -35,15 +35,11 @@ func NewBranchListBuilder(log *logrus.Entry, gitCommand *commands.GitCommand) (*
}
func (b *BranchListBuilder) obtainCurrentBranch() *commands.Branch {
- // I used go-git for this, but that breaks if you've just done a git init,
- // even though you're on 'master'
- branchName, err := b.GitCommand.OSCommand.RunCommandWithOutput("git symbolic-ref --short HEAD")
+ branchName, err := b.GitCommand.CurrentBranchName()
if err != nil {
- branchName, err = b.GitCommand.OSCommand.RunCommandWithOutput("git rev-parse --short HEAD")
- if err != nil {
- panic(err.Error())
- }
+ panic(err.Error())
}
+
return &commands.Branch{Name: strings.TrimSpace(branchName), Recency: " *"}
}