summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-09-25 20:31:19 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-09-25 20:31:19 +1000
commiteb69d98f99f77669ffbb8463f6f6d84441c638d4 (patch)
tree5c53873b6d1fc1896948836c0a96755c36719259 /pkg/commands/git.go
parentfb9596a3fffa5c707b27fb0eee1768d76aefd206 (diff)
add test for CurrentBranchName
Diffstat (limited to 'pkg/commands/git.go')
-rw-r--r--pkg/commands/git.go6
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