diff --git a/make.go b/make.go index 74a8afa23..af4e5aebc 100644 --- a/make.go +++ b/make.go @@ -814,13 +814,14 @@ func getVersion() string { return gitVersion() } -var gitVersionRx = regexp.MustCompile(`\b\d\d\d\d-\d\d-\d\d-[0-9a-f]{7,7}\b`) +var gitVersionRx = regexp.MustCompile(`\b\d\d\d\d-\d\d-\d\d-[0-9a-f]{10,10}\b`) // gitVersion returns the git version of the git repo at camRoot as a // string of the form "yyyy-mm-dd-xxxxxxx", with an optional trailing // '+' if there are any local uncomitted modifications to the tree. func gitVersion() string { - cmd := exec.Command("git", "rev-list", "--max-count=1", "--pretty=format:'%ad-%h'", "--date=short", "HEAD") + cmd := exec.Command("git", "rev-list", "--max-count=1", "--pretty=format:'%ad-%h'", + "--date=short", "--abbrev=10", "HEAD") cmd.Dir = camRoot out, err := cmd.Output() if err != nil { diff --git a/misc/docker/release/build-binaries.go b/misc/docker/release/build-binaries.go index 89ff0297c..eb83848de 100644 --- a/misc/docker/release/build-binaries.go +++ b/misc/docker/release/build-binaries.go @@ -81,6 +81,7 @@ func rev() string { } func version() string { + // TODO(mpl): cut the rev to 10 chars, like make.go would do? if *flagVersion != "" { return fmt.Sprintf("%v (git rev %v)", *flagVersion, rev()) }