From: Mark Pulford Date: Sun, 27 Feb 2022 12:52:22 +0000 (+1030) Subject: [release-branch.go1.18] cmd/go: fix buildvcs when using older git versions X-Git-Tag: go1.18~11 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1e4dc06f1ac1caa36eefb9eb0835010a66d9f29e;p=gostls13.git [release-branch.go1.18] cmd/go: fix buildvcs when using older git versions Git versions before v2.10.0 do not support --no-show-signature. Using "-c" allows Git to ignore the configuration option if it does not exist. Fixes #51253 Change-Id: I2b1adaca0eb18ae31f2e1119e354ce515b00cfc2 Reviewed-on: https://go-review.googlesource.com/c/go/+/388194 Trust: Dmitri Shuralyov Run-TryBot: Dmitri Shuralyov TryBot-Result: Gopher Robot Reviewed-by: Bryan Mills (cherry picked from commit 7026eeb8cfdc5801adddaaa678fb6495a998db0e) Reviewed-on: https://go-review.googlesource.com/c/go/+/391354 --- diff --git a/src/cmd/go/internal/vcs/vcs.go b/src/cmd/go/internal/vcs/vcs.go index fd521b2eb1..2acabf7aaf 100644 --- a/src/cmd/go/internal/vcs/vcs.go +++ b/src/cmd/go/internal/vcs/vcs.go @@ -312,7 +312,7 @@ func gitStatus(vcsGit *Cmd, rootDir string) (Status, error) { // uncommitted files and skip tagging revision / committime. var rev string var commitTime time.Time - out, err = vcsGit.runOutputVerboseOnly(rootDir, "show -s --no-show-signature --format=%H:%ct") + out, err = vcsGit.runOutputVerboseOnly(rootDir, "-c log.showsignature=false show -s --format=%H:%ct") if err != nil && !uncommitted { return Status{}, err } else if err == nil { diff --git a/src/cmd/go/testdata/script/version_buildvcs_git.txt b/src/cmd/go/testdata/script/version_buildvcs_git.txt index 86d1de06df..44706870e2 100644 --- a/src/cmd/go/testdata/script/version_buildvcs_git.txt +++ b/src/cmd/go/testdata/script/version_buildvcs_git.txt @@ -111,7 +111,7 @@ rm $GOBIN/d$GOEXE go list -x ./... stdout -count=3 '^example.com' stderr -count=1 '^git status' -stderr -count=1 '^git show' +stderr -count=1 '^git -c log.showsignature=false show' -- $WORK/fakebin/git -- #!/bin/sh