1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-26 09:00:57 +02:00

try rev-parse of git symbolic-ref returns nothing

This commit is contained in:
Jesse Duffield 2018-08-15 09:42:02 +10:00
parent 652237d48f
commit 922f4ed5a4

View File

@ -38,9 +38,12 @@ 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")
if err != nil {
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: " *"}
}