1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-23 00:39:13 +02:00

refactor commands to depend less on the shell

This commit is contained in:
Jesse Duffield
2018-08-14 17:47:33 +10:00
parent 95c7df4c61
commit 9ecd7908aa
7 changed files with 113 additions and 110 deletions

View File

@ -37,7 +37,10 @@ func NewBranchListBuilder(log *logrus.Logger, 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, _ := b.GitCommand.OSCommand.RunDirectCommand("git symbolic-ref --short HEAD")
branchName, err := b.GitCommand.OSCommand.RunCommandWithOutput("git symbolic-ref --short HEAD")
if err != nil {
panic(err.Error())
}
return commands.Branch{Name: strings.TrimSpace(branchName), Recency: " *"}
}