Skip to content

Commit 39d4bb9

Browse files
ianlancetaylorrsc
authored andcommitted
[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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Russ Cox <[email protected]> Reviewed-on: https://go-review.googlesource.com/70984 Run-TryBot: Russ Cox <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent bfc2231 commit 39d4bb9

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/cmd/go/go_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ func testMove(t *testing.T, vcs, url, base, config string) {
11641164
tg.runFail("get", "-d", "-u", url)
11651165
tg.grepStderr("is a custom import path for", "go get -d -u "+url+" failed for wrong reason")
11661166
tg.runFail("get", "-d", "-f", "-u", url)
1167-
tg.grepStderr("validating server certificate|not found", "go get -d -f -u "+url+" failed for wrong reason")
1167+
tg.grepStderr("validating server certificate|[nN]ot [fF]ound", "go get -d -f -u "+url+" failed for wrong reason")
11681168
}
11691169

11701170
func TestInternalPackageErrorsAreHandled(t *testing.T) {
@@ -1185,10 +1185,9 @@ func TestMoveGit(t *testing.T) {
11851185
testMove(t, "git", "rsc.io/pdf", "pdf", "rsc.io/pdf/.git/config")
11861186
}
11871187

1188-
// TODO(rsc): Set up a test case on bitbucket for hg.
1189-
// func TestMoveHG(t *testing.T) {
1190-
// testMove(t, "hg", "rsc.io/x86/x86asm", "x86", "rsc.io/x86/.hg/hgrc")
1191-
// }
1188+
func TestMoveHG(t *testing.T) {
1189+
testMove(t, "hg", "vcs-test.golang.org/go/custom-hg-hello", "custom-hg-hello", "vcs-test.golang.org/go/custom-hg-hello/.hg/hgrc")
1190+
}
11921191

11931192
// TODO(rsc): Set up a test case on SourceForge (?) for svn.
11941193
// func testMoveSVN(t *testing.T) {

src/cmd/go/internal/get/vcs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ func checkNestedVCS(vcs *vcsCmd, dir, srcRoot string) error {
557557
otherDir := dir
558558
for len(otherDir) > len(srcRoot) {
559559
for _, otherVCS := range vcsList {
560-
if _, err := os.Stat(filepath.Join(dir, "."+otherVCS.cmd)); err == nil {
560+
if _, err := os.Stat(filepath.Join(otherDir, "."+otherVCS.cmd)); err == nil {
561561
// Allow expected vcs in original dir.
562562
if otherDir == dir && otherVCS == vcs {
563563
continue

0 commit comments

Comments
 (0)