mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
Fix commit extraction
This commit is contained in:
parent
7dbb075c07
commit
5065a81feb
1 changed files with 5 additions and 0 deletions
|
|
@ -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 == "" {
|
||||
|
|
|
|||
Loading…
Reference in a new issue