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 <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
This commit is contained in:
Mark Pulford 2022-02-27 23:22:22 +10:30 committed by Bryan Mills
parent 0d33a99675
commit 7026eeb8cf
2 changed files with 2 additions and 2 deletions

View file

@ -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 {

View file

@ -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