fix issue from PR #10
This commit is contained in:
parent
8793c8a6a4
commit
20f20eddf7
1 changed files with 6 additions and 8 deletions
|
@ -72,20 +72,18 @@ func findGitHead(file string) (string, error) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
headBuffer := new(bytes.Buffer)
|
headBuffer := new(bytes.Buffer)
|
||||||
length, err := headBuffer.ReadFrom(bufio.NewReader(headFile))
|
_, err = headBuffer.ReadFrom(bufio.NewReader(headFile))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
}
|
}
|
||||||
|
headBytes := headBuffer.Bytes()
|
||||||
|
|
||||||
var ref string
|
var ref string
|
||||||
if length <= 42 {
|
|
||||||
ref = string(headBuffer.Bytes()[:40])
|
|
||||||
} else {
|
|
||||||
head := make(map[string]string)
|
head := make(map[string]string)
|
||||||
err = yaml.Unmarshal(headBuffer.Bytes(), head)
|
err = yaml.Unmarshal(headBytes, head)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
ref = string(headBytes)
|
||||||
}
|
} else {
|
||||||
ref = head["ref"]
|
ref = head["ref"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue