diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-09-25 20:31:19 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-09-25 20:31:19 +1000 |
commit | eb69d98f99f77669ffbb8463f6f6d84441c638d4 (patch) | |
tree | 5c53873b6d1fc1896948836c0a96755c36719259 /pkg/commands/git.go | |
parent | fb9596a3fffa5c707b27fb0eee1768d76aefd206 (diff) |
add test for CurrentBranchName
Diffstat (limited to 'pkg/commands/git.go')
-rw-r--r-- | pkg/commands/git.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 4d132237f..402ec3378 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -268,7 +268,11 @@ func (c *GitCommand) NewBranch(name string) error { } func (c *GitCommand) CurrentBranchName() (string, error) { - return c.OSCommand.RunCommandWithOutput("git symbolic-ref --short HEAD") + output, err := c.OSCommand.RunCommandWithOutput("git symbolic-ref --short HEAD") + if err != nil { + return "", err + } + return utils.TrimTrailingNewline(output), nil } // DeleteBranch delete branch |