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 {
|
head := make(map[string]string)
|
||||||
ref = string(headBuffer.Bytes()[:40])
|
err = yaml.Unmarshal(headBytes, head)
|
||||||
|
if err != nil {
|
||||||
|
ref = string(headBytes)
|
||||||
} else {
|
} else {
|
||||||
head := make(map[string]string)
|
|
||||||
err = yaml.Unmarshal(headBuffer.Bytes(), head)
|
|
||||||
if err != nil {
|
|
||||||
log.Error(err)
|
|
||||||
}
|
|
||||||
ref = head["ref"]
|
ref = head["ref"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue