aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2019-08-27 14:18:48 -0400
committerBryan C. Mills <bcmills@google.com>2019-08-27 21:10:30 +0000
commit2e3989e04effe63de165cd81df49284dc12b1bf8 (patch)
tree558dfb448b74881981fb26051cfeaf081259c8c1
parentc11853c09b71ebdcc2b960bc30ee8e6e61b0c35b (diff)
downloadgo-2e3989e04effe63de165cd81df49284dc12b1bf8.tar.gz
go-2e3989e04effe63de165cd81df49284dc12b1bf8.zip
[release-branch.go1.13] cmd/go/internal/get: remove '--' separator from 'git ls-remote' command
'git ls-remote' started recognizing the '--' separator at some point after 2.7.4, but git defaults to version 2.7.4 on Ubuntu 16.04 LTS, which remains supported by Ubuntu until April 2021. We added '--' tokens to most VCS commands as a defensive measure in CL 181237, but it isn't strictly necessary here because the 'scheme' argument to our template is chosen from a predefined list: we can safely drop it to retain compatibility. Cherry-picked from CL 191978. Updates #33836 Fixes #33880 Change-Id: Ibb53366b95f8029b587e0b7646a439330d759ac7 Reviewed-on: https://go-review.googlesource.com/c/go/+/191973 Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-rw-r--r--src/cmd/go/internal/get/vcs.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cmd/go/internal/get/vcs.go b/src/cmd/go/internal/get/vcs.go
index fca78b515f..705bb66dbe 100644
--- a/src/cmd/go/internal/get/vcs.go
+++ b/src/cmd/go/internal/get/vcs.go
@@ -164,8 +164,14 @@ var vcsGit = &vcsCmd{
// See golang.org/issue/9032.
tagSyncDefault: []string{"submodule update --init --recursive"},
- scheme: []string{"git", "https", "http", "git+ssh", "ssh"},
- pingCmd: "ls-remote -- {scheme}://{repo}",
+ scheme: []string{"git", "https", "http", "git+ssh", "ssh"},
+
+ // Leave out the '--' separator in the ls-remote command: git 2.7.4 does not
+ // support such a separator for that command, and this use should be safe
+ // without it because the {scheme} value comes from the predefined list above.
+ // See golang.org/issue/33836.
+ pingCmd: "ls-remote {scheme}://{repo}",
+
remoteRepo: gitRemoteRepo,
}