]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: read URL not Repository Root from svn info
authorRuss Cox <rsc@golang.org>
Wed, 21 Jun 2017 20:32:19 +0000 (16:32 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 22 Jun 2017 16:47:27 +0000 (16:47 +0000)
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>
src/cmd/go/internal/get/vcs.go

index c656debf8ae8b9bed25cf06e0bf5a02ddff31f86..71d0b51344a979c0ffc2921585b3c232d087a9db 100644 (file)
@@ -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")