diff options
author | Russ Cox <rsc@golang.org> | 2017-06-21 16:32:19 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2017-06-22 16:47:27 +0000 |
commit | 1080cece5af840349df06d651b9d5d5fa6925fed (patch) | |
tree | f268f229661f490670f111549a3c3742c5f1b373 | |
parent | ac7f7ecaeb1261262963992496c2562c839fc272 (diff) | |
download | go-1080cece5af840349df06d651b9d5d5fa6925fed.tar.gz go-1080cece5af840349df06d651b9d5d5fa6925fed.zip |
cmd/go: read URL not Repository Root from svn info
This makes custom import path checks work even when the
custom import metadata directs checking out a subtree
of the subversion repository.
(Git and Mercurial allow no such thing, so they are unaffected.)
Fixes #20731.
Change-Id: I635f3a2037d69a87c6dac7b08b0a0d8266abd250
Reviewed-on: https://go-review.googlesource.com/46417
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
-rw-r--r-- | src/cmd/go/internal/get/vcs.go | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/cmd/go/internal/get/vcs.go b/src/cmd/go/internal/get/vcs.go index c656debf8a..71d0b51344 100644 --- a/src/cmd/go/internal/get/vcs.go +++ b/src/cmd/go/internal/get/vcs.go @@ -302,15 +302,20 @@ func svnRemoteRepo(vcsSvn *vcsCmd, rootDir string) (remoteRepo string, err error out := string(outb) // Expect: - // ... - // Repository Root: <URL> - // ... - - i := strings.Index(out, "\nRepository Root: ") + // + // ... + // URL: <URL> + // ... + // + // Note that we're not using the Repository Root line, + // because svn allows checking out subtrees. + // The URL will be the URL of the subtree (what we used with 'svn co') + // while the Repository Root may be a much higher parent. + i := strings.Index(out, "\nURL: ") if i < 0 { return "", fmt.Errorf("unable to parse output of svn info") } - out = out[i+len("\nRepository Root: "):] + out = out[i+len("\nURL: "):] i = strings.Index(out, "\n") if i < 0 { return "", fmt.Errorf("unable to parse output of svn info") |