mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +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 {
|
if splits := strings.Split(head, " "); len(splits) == 2 {
|
||||||
head = splits[1]
|
head = splits[1]
|
||||||
} else {
|
} 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})$")
|
commitRe, _ := regexp.Compile("^([0-9a-f]{40})$")
|
||||||
if commit := commitRe.FindString(head); commit != "" && env.Commit == "" {
|
if commit := commitRe.FindString(head); commit != "" && env.Commit == "" {
|
||||||
env.Commit = commit
|
env.Commit = commit
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue