aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modfetch/codehost/git.go
diff options
context:
space:
mode:
authorhidu <duv123@gmail.com>2022-03-03 13:33:38 +0800
committerHeschi Kreinick <heschi@google.com>2022-07-06 18:36:43 +0000
commit77cc1c0defaf4cd6c38221504b29ad125aae9ac7 (patch)
tree011caf23564366dc83d051dd5adc61c6dfc54c9b /src/cmd/go/internal/modfetch/codehost/git.go
parent8d2935ab7ccf621443691fa8c103a6decf4fbfb2 (diff)
downloadgo-77cc1c0defaf4cd6c38221504b29ad125aae9ac7.tar.gz
go-77cc1c0defaf4cd6c38221504b29ad125aae9ac7.zip
[release-branch.go1.17] cmd/go: pass --no-decorate when listing git tags for a commit
This avoids a parse error when the user's global .gitconfig sets log.decorate to true. Updates #51312. Fixes #51351. Change-Id: Ic47b0f604c0c3a404ec50d6e09f4e138045ac2f2 Reviewed-on: https://go-review.googlesource.com/c/go/+/387835 Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> (cherry picked from commit a30f4346674ec43bf576e6f56a9cd1c7ca482e1f) Reviewed-on: https://go-review.googlesource.com/c/go/+/414875
Diffstat (limited to 'src/cmd/go/internal/modfetch/codehost/git.go')
-rw-r--r--src/cmd/go/internal/modfetch/codehost/git.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modfetch/codehost/git.go b/src/cmd/go/internal/modfetch/codehost/git.go
index 4d4964edf4..55aecd04c9 100644
--- a/src/cmd/go/internal/modfetch/codehost/git.go
+++ b/src/cmd/go/internal/modfetch/codehost/git.go
@@ -440,7 +440,7 @@ func (r *gitRepo) fetchRefsLocked() error {
// statLocal returns a RevInfo describing rev in the local git repository.
// It uses version as info.Version.
func (r *gitRepo) statLocal(version, rev string) (*RevInfo, error) {
- out, err := Run(r.dir, "git", "-c", "log.showsignature=false", "log", "-n1", "--format=format:%H %ct %D", rev, "--")
+ out, err := Run(r.dir, "git", "-c", "log.showsignature=false", "log", "--no-decorate", "-n1", "--format=format:%H %ct %D", rev, "--")
if err != nil {
return nil, &UnknownRevisionError{Rev: rev}
}