mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
Comments for commit extraction
Requested in https://github.com/ethereum/go-ethereum/pull/18315
This commit is contained in:
parent
5065a81feb
commit
4d5cca8ef2
1 changed files with 3 additions and 0 deletions
|
|
@ -88,6 +88,9 @@ func LocalEnv() Environment {
|
|||
if splits := strings.Split(head, " "); len(splits) == 2 {
|
||||
head = splits[1]
|
||||
} else {
|
||||
// In this case we are in "detached head" state
|
||||
// see: https://git-scm.com/docs/git-checkout#_detached_head
|
||||
// Additional check required to verify, that file contains commit hash
|
||||
commitRe, _ := regexp.Compile("^([0-9a-f]{40})$")
|
||||
if commit := commitRe.FindString(head); commit != "" && env.Commit == "" {
|
||||
env.Commit = commit
|
||||
|
|
|
|||
Loading…
Reference in a new issue