From: Russ Cox Date: Wed, 21 Jun 2017 20:32:19 +0000 (-0400) Subject: cmd/go: read URL not Repository Root from svn info X-Git-Tag: go1.9beta2~25 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1080cece5af840349df06d651b9d5d5fa6925fed;p=gostls13.git 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- 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: - // ... - - i := strings.Index(out, "\nRepository Root: ") + // + // ... + // 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")