Skip to content

Commit 533ee44

Browse files
ianlancetaylorrsc
authored andcommitted
[release-branch.go1.8] 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/70839 Run-TryBot: Russ Cox <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 8093678 commit 533ee44

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
@@ -1120,7 +1120,7 @@ func testMove(t *testing.T, vcs, url, base, config string) {
11201120
tg.runFail("get", "-d", "-u", url)
11211121
tg.grepStderr("is a custom import path for", "go get -d -u "+url+" failed for wrong reason")
11221122
tg.runFail("get", "-d", "-f", "-u", url)
1123-
tg.grepStderr("validating server certificate|not found", "go get -d -f -u "+url+" failed for wrong reason")
1123+
tg.grepStderr("validating server certificate|[nN]ot [fF]ound", "go get -d -f -u "+url+" failed for wrong reason")
11241124
}
11251125

11261126
func TestInternalPackageErrorsAreHandled(t *testing.T) {
@@ -1141,10 +1141,9 @@ func TestMoveGit(t *testing.T) {
11411141
testMove(t, "git", "rsc.io/pdf", "pdf", "rsc.io/pdf/.git/config")
11421142
}
11431143

1144-
// TODO(rsc): Set up a test case on bitbucket for hg.
1145-
// func TestMoveHG(t *testing.T) {
1146-
// testMove(t, "hg", "rsc.io/x86/x86asm", "x86", "rsc.io/x86/.hg/hgrc")
1147-
// }
1144+
func TestMoveHG(t *testing.T) {
1145+
testMove(t, "hg", "vcs-test.golang.org/go/custom-hg-hello", "custom-hg-hello", "vcs-test.golang.org/go/custom-hg-hello/.hg/hgrc")
1146+
}
11481147

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

src/cmd/go/vcs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ func checkNestedVCS(vcs *vcsCmd, dir, srcRoot string) error {
548548
otherDir := dir
549549
for len(otherDir) > len(srcRoot) {
550550
for _, otherVCS := range vcsList {
551-
if _, err := os.Stat(filepath.Join(dir, "."+otherVCS.cmd)); err == nil {
551+
if _, err := os.Stat(filepath.Join(otherDir, "."+otherVCS.cmd)); err == nil {
552552
// Allow expected vcs in original dir.
553553
if otherDir == dir && otherVCS == vcs {
554554
continue

0 commit comments

Comments
 (0)