diff options
author | Ian Lance Taylor <iant@golang.org> | 2017-10-10 14:10:28 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2017-10-25 20:23:27 +0000 |
commit | 39d4bb9c0f3ac3f87de64b069ea176595e39d46c (patch) | |
tree | 7b352f898b548f039a017e8471319eb467f8f60b | |
parent | bfc22319aa349f014a34d73cff074bf3cce0df9c (diff) | |
download | go-39d4bb9c0f3ac3f87de64b069ea176595e39d46c.tar.gz go-39d4bb9c0f3ac3f87de64b069ea176595e39d46c.zip |
[release-branch.go1.9] cmd/go: correct directory used in checkNestedVCS test
This error was not used when using git because nested git is permitted.
Add test using Mercurial, so that at least we have a test, even though
the test is not run by default.
Fixes #22157
Fixes #22201
Change-Id: If521f3c09b0754e00e56fa3cd0364764a57a43ad
Reviewed-on: https://go-review.googlesource.com/69670
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-on: https://go-review.googlesource.com/70984
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
-rw-r--r-- | src/cmd/go/go_test.go | 9 | ||||
-rw-r--r-- | src/cmd/go/internal/get/vcs.go | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index c1b3975c7b..234e560e6b 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -1164,7 +1164,7 @@ func testMove(t *testing.T, vcs, url, base, config string) { tg.runFail("get", "-d", "-u", url) tg.grepStderr("is a custom import path for", "go get -d -u "+url+" failed for wrong reason") tg.runFail("get", "-d", "-f", "-u", url) - tg.grepStderr("validating server certificate|not found", "go get -d -f -u "+url+" failed for wrong reason") + tg.grepStderr("validating server certificate|[nN]ot [fF]ound", "go get -d -f -u "+url+" failed for wrong reason") } func TestInternalPackageErrorsAreHandled(t *testing.T) { @@ -1185,10 +1185,9 @@ func TestMoveGit(t *testing.T) { testMove(t, "git", "rsc.io/pdf", "pdf", "rsc.io/pdf/.git/config") } -// TODO(rsc): Set up a test case on bitbucket for hg. -// func TestMoveHG(t *testing.T) { -// testMove(t, "hg", "rsc.io/x86/x86asm", "x86", "rsc.io/x86/.hg/hgrc") -// } +func TestMoveHG(t *testing.T) { + testMove(t, "hg", "vcs-test.golang.org/go/custom-hg-hello", "custom-hg-hello", "vcs-test.golang.org/go/custom-hg-hello/.hg/hgrc") +} // TODO(rsc): Set up a test case on SourceForge (?) for svn. // func testMoveSVN(t *testing.T) { diff --git a/src/cmd/go/internal/get/vcs.go b/src/cmd/go/internal/get/vcs.go index f0e253ffb4..86d2e32efb 100644 --- a/src/cmd/go/internal/get/vcs.go +++ b/src/cmd/go/internal/get/vcs.go @@ -557,7 +557,7 @@ func checkNestedVCS(vcs *vcsCmd, dir, srcRoot string) error { otherDir := dir for len(otherDir) > len(srcRoot) { for _, otherVCS := range vcsList { - if _, err := os.Stat(filepath.Join(dir, "."+otherVCS.cmd)); err == nil { + if _, err := os.Stat(filepath.Join(otherDir, "."+otherVCS.cmd)); err == nil { // Allow expected vcs in original dir. if otherDir == dir && otherVCS == vcs { continue |