aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-12-17 20:25:33 +0000
committerRuss Cox <rsc@golang.org>2015-12-17 20:25:42 +0000
commit9f0055a232384453c07aff702fcbe15820140d50 (patch)
tree56da74aa5b27796896fbb15f09c0e3f78ff12641
parentc052222b3467ca031b267f25f3dcc4b871485793 (diff)
downloadgo-9f0055a232384453c07aff702fcbe15820140d50.tar.gz
go-9f0055a232384453c07aff702fcbe15820140d50.zip
Revert "cmd/go: allow omitted user name in git ssh repo syntax"
This caused #13657. Reverting fixes #13657. I was trying to be helpful by fixing #12313, but I don't need the fix myself. Will leave for someone with more motivation. This reverts commit 3e9f0636709de7cd86a08785f2e64487580bf5ea. Change-Id: Ifc78a6196f23e0f58e3b9ad7340e207a2d5de0a6 Reviewed-on: https://go-review.googlesource.com/17977 Reviewed-by: Russ Cox <rsc@golang.org>
-rw-r--r--src/cmd/go/vcs.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/cmd/go/vcs.go b/src/cmd/go/vcs.go
index 743205bfd8..59e72c6de2 100644
--- a/src/cmd/go/vcs.go
+++ b/src/cmd/go/vcs.go
@@ -147,7 +147,7 @@ var vcsGit = &vcsCmd{
// scpSyntaxRe matches the SCP-like addresses used by Git to access
// repositories by SSH.
-var scpSyntaxRe = regexp.MustCompile(`^(?:([a-zA-Z0-9_]+)@)?([a-zA-Z0-9._-]+):(.*)$`)
+var scpSyntaxRe = regexp.MustCompile(`^([a-zA-Z0-9_]+)@([a-zA-Z0-9._-]+):(.*)$`)
func gitRemoteRepo(vcsGit *vcsCmd, rootDir string) (remoteRepo string, err error) {
cmd := "config remote.origin.url"
@@ -171,12 +171,10 @@ func gitRemoteRepo(vcsGit *vcsCmd, rootDir string) (remoteRepo string, err error
// "ssh://git@github.com/user/repo".
repoURL = &url.URL{
Scheme: "ssh",
+ User: url.User(m[1]),
Host: m[2],
RawPath: m[3],
}
- if m[1] != "" {
- repoURL.User = url.User(m[1])
- }
} else {
repoURL, err = url.Parse(out)
if err != nil {