]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: avoid use of git -C, which does not exist in RHEL 7
authorRuss Cox <rsc@golang.org>
Tue, 2 Feb 2016 15:10:27 +0000 (10:10 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 2 Feb 2016 16:36:43 +0000 (16:36 +0000)
Tested manually with "go test -run TestGetSubmodules".

Fixes #14194.

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

index 074dd8b2b1259bb7bb7105af9b474b5009bd76c0..342edee50d9c8688dc52cd37d1e30c95af8b3b19 100644 (file)
@@ -122,7 +122,7 @@ var vcsGit = &vcsCmd{
        name: "Git",
        cmd:  "git",
 
-       createCmd:   []string{"clone {repo} {dir}", "-C {dir} submodule update --init --recursive"},
+       createCmd:   []string{"clone {repo} {dir}", "-go-internal-cd {dir} submodule update --init --recursive"},
        downloadCmd: []string{"pull --ff-only", "submodule update --init --recursive"},
 
        tagCmd: []tagCmd{
@@ -335,6 +335,15 @@ func (v *vcsCmd) run1(dir string, cmdline string, keyval []string, verbose bool)
                args[i] = expand(m, arg)
        }
 
+       if len(args) >= 2 && args[0] == "-go-internal-cd" {
+               if filepath.IsAbs(args[1]) {
+                       dir = args[1]
+               } else {
+                       dir = filepath.Join(dir, args[1])
+               }
+               args = args[2:]
+       }
+
        _, err := exec.LookPath(v.cmd)
        if err != nil {
                fmt.Fprintf(os.Stderr,