]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: fix git submodule fetch
authorRuss Cox <rsc@golang.org>
Thu, 17 Dec 2015 19:33:06 +0000 (14:33 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 17 Dec 2015 20:18:18 +0000 (20:18 +0000)
Thanks to @toxeus on GitHub for the test case.

Fixes #12612.

Change-Id: I0c32fbe5044f3552053460a5347c062568093dff
Reviewed-on: https://go-review.googlesource.com/17974
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/go/vcs.go
src/cmd/go/vendor_test.go

index 946b6ae7bf6c1daab3ce0dbddfb11d5c1402bc5d..743205bfd8922fde25106e074d82741a87959535 100644 (file)
@@ -122,7 +122,7 @@ var vcsGit = &vcsCmd{
        name: "Git",
        cmd:  "git",
 
-       createCmd:   []string{"clone {repo} {dir}", "--git-dir={dir}/.git submodule update --init --recursive"},
+       createCmd:   []string{"clone {repo} {dir}", "-C {dir} submodule update --init --recursive"},
        downloadCmd: []string{"pull --ff-only", "submodule update --init --recursive"},
 
        tagCmd: []tagCmd{
index 766392fe3afde9fc5a815ca598048949e7a8f704..ed73be36a8f1ac486e0a93307bd1788695232521 100644 (file)
@@ -187,6 +187,18 @@ func TestVendorGetUpdate(t *testing.T) {
        tg.run("get", "-u", "github.com/rsc/go-get-issue-11864")
 }
 
+func TestGetSubmodules(t *testing.T) {
+       testenv.MustHaveExternalNetwork(t)
+
+       tg := testgo(t)
+       defer tg.cleanup()
+       tg.makeTempdir()
+       tg.setenv("GOPATH", tg.path("."))
+       tg.setenv("GO15VENDOREXPERIMENT", "1")
+       tg.run("get", "-d", "github.com/rsc/go-get-issue-12612")
+       tg.run("get", "-u", "-d", "github.com/rsc/go-get-issue-12612")
+}
+
 func TestVendorCache(t *testing.T) {
        tg := testgo(t)
        defer tg.cleanup()