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

Merge branch 'master' into https-ask-for-username-password

This commit is contained in:
Mark Kopenga
2018-11-14 13:40:17 +01:00
committed by GitHub
3 changed files with 43 additions and 23 deletions

View File

@ -208,11 +208,6 @@ func includesInt(list []int, a int) bool {
return false
}
// GetBranchName branch name
func (c *GitCommand) GetBranchName() (string, error) {
return c.OSCommand.RunCommandWithOutput("git symbolic-ref --short HEAD")
}
// ResetHard does the equivalent of `git reset --hard HEAD`
func (c *GitCommand) ResetHard() error {
return c.Worktree.Reset(&gogit.ResetOptions{Mode: gogit.HardReset})
@ -268,11 +263,14 @@ func (c *GitCommand) NewBranch(name string) error {
}
func (c *GitCommand) CurrentBranchName() (string, error) {
output, err := c.OSCommand.RunCommandWithOutput("git symbolic-ref --short HEAD")
branchName, err := c.OSCommand.RunCommandWithOutput("git symbolic-ref --short HEAD")
if err != nil {
return "", err
branchName, err = c.OSCommand.RunCommandWithOutput("git rev-parse --short HEAD")
if err != nil {
return "", err
}
}
return utils.TrimTrailingNewline(output), nil
return utils.TrimTrailingNewline(branchName), nil
}
// DeleteBranch delete branch