From 7e92f699a955de68908ecc22b36a63d96ae72e02 Mon Sep 17 00:00:00 2001 From: Casey Lee <cplee@nektos.com> Date: Tue, 12 Feb 2019 23:02:24 -0500 Subject: [PATCH] fix #31 - trim whitespace on git revision --- common/git.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/git.go b/common/git.go index a2f7925..ed16854 100644 --- a/common/git.go +++ b/common/git.go @@ -46,7 +46,7 @@ func FindGitRevision(file string) (shortSha string, sha string, err error) { } log.Debugf("Found revision: %s", refBuf) - return string(refBuf[:7]), string(refBuf), nil + return string(refBuf[:7]), strings.TrimSpace(string(refBuf)), nil } // FindGitBranch get the current git branch @@ -90,14 +90,14 @@ func FindGitRef(file string) (string, error) { head := make(map[string]string) err = yaml.Unmarshal(headBytes, head) if err != nil { - ref = strings.TrimRight(string(headBytes), "\r\n") + ref = string(headBytes) } else { ref = head["ref"] } log.Debugf("HEAD points to '%s'", ref) - return ref, nil + return strings.TrimSpace(ref), nil } // FindGithubRepo get the repo