better upstream tracking and allow renaming a branch

This commit is contained in:
Jesse Duffield 2020-03-17 21:22:07 +11:00
parent 2169b5109f
commit 1be0ff8da7
12 changed files with 222 additions and 146 deletions

View file

@ -343,7 +343,7 @@ func (c *GitCommand) CurrentBranchName() (string, error) {
match := re.FindStringSubmatch(output)
branchName = match[1]
}
return utils.TrimTrailingNewline(branchName), nil
return strings.TrimSpace(branchName), nil
}
// DeleteBranch delete branch
@ -1163,3 +1163,7 @@ func (c *GitCommand) GetPager(width int) string {
func (c *GitCommand) colorArg() string {
return c.Config.GetUserConfig().GetString("git.paging.colorArg")
}
func (c *GitCommand) RenameBranch(oldName string, newName string) error {
return c.OSCommand.RunCommand("git branch --move %s %s", oldName, newName)
}