Skip to content

Commit 0a778cf

Browse files
author
Bryan C. Mills
committed
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. Fixes #33836 Updates #26746 Change-Id: Ibb53366b95f8029b587e0b7646a439330d759ac7 Reviewed-on: https://go-review.googlesource.com/c/go/+/191978 Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 260e3d0 commit 0a778cf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/cmd/go/internal/get/vcs.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,14 @@ var vcsGit = &vcsCmd{
164164
// See golang.org/issue/9032.
165165
tagSyncDefault: []string{"submodule update --init --recursive"},
166166

167-
scheme: []string{"git", "https", "http", "git+ssh", "ssh"},
168-
pingCmd: "ls-remote -- {scheme}://{repo}",
167+
scheme: []string{"git", "https", "http", "git+ssh", "ssh"},
168+
169+
// Leave out the '--' separator in the ls-remote command: git 2.7.4 does not
170+
// support such a separator for that command, and this use should be safe
171+
// without it because the {scheme} value comes from the predefined list above.
172+
// See golang.org/issue/33836.
173+
pingCmd: "ls-remote {scheme}://{repo}",
174+
169175
remoteRepo: gitRemoteRepo,
170176
}
171177

0 commit comments

Comments
 (0)