Fix commit extraction

This commit is contained in:
Aleksey @soar Smyrnov 2018-12-15 23:38:39 +03:00 committed by GitHub
parent 7dbb075c07
commit 5065a81feb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,6 +20,7 @@ import (
"flag"
"fmt"
"os"
"regexp"
"strings"
)
@ -87,6 +88,10 @@ func LocalEnv() Environment {
if splits := strings.Split(head, " "); len(splits) == 2 {
head = splits[1]
} else {
commitRe, _ := regexp.Compile("^([0-9a-f]{40})$")
if commit := commitRe.FindString(head); commit != "" && env.Commit == "" {
env.Commit = commit
}
return env
}
if env.Commit == "" {