From eb69d98f99f77669ffbb8463f6f6d84441c638d4 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Tue, 25 Sep 2018 20:31:19 +1000 Subject: add test for CurrentBranchName --- pkg/commands/git.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pkg/commands/git.go') 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 -- cgit v1.2.3