1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-30 09:16:47 +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

@ -39,7 +39,10 @@ func (b *BranchListBuilder) obtainCurrentBranch() commands.Branch {
// even though you're on 'master' // even though you're on 'master'
branchName, err := b.GitCommand.OSCommand.RunCommandWithOutput("git symbolic-ref --short HEAD") branchName, err := b.GitCommand.OSCommand.RunCommandWithOutput("git symbolic-ref --short HEAD")
if err != nil { 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: " *"} return commands.Branch{Name: strings.TrimSpace(branchName), Recency: " *"}
} }