1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-11 17:50:58 +00:00

fix #31 - trim whitespace on git revision

This commit is contained in:
Casey Lee 2019-02-12 23:02:24 -05:00
parent 57490858a1
commit 36c11232c1

View file

@ -46,7 +46,7 @@ func FindGitRevision(file string) (shortSha string, sha string, err error) {
} }
log.Debugf("Found revision: %s", refBuf) 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 // FindGitBranch get the current git branch
@ -90,14 +90,14 @@ func FindGitRef(file string) (string, error) {
head := make(map[string]string) head := make(map[string]string)
err = yaml.Unmarshal(headBytes, head) err = yaml.Unmarshal(headBytes, head)
if err != nil { if err != nil {
ref = strings.TrimRight(string(headBytes), "\r\n") ref = string(headBytes)
} else { } else {
ref = head["ref"] ref = head["ref"]
} }
log.Debugf("HEAD points to '%s'", ref) log.Debugf("HEAD points to '%s'", ref)
return ref, nil return strings.TrimSpace(ref), nil
} }
// FindGithubRepo get the repo // FindGithubRepo get the repo