From: Russ Cox Date: Tue, 2 Feb 2016 15:10:27 +0000 (-0500) Subject: cmd/go: avoid use of git -C, which does not exist in RHEL 7 X-Git-Tag: go1.6rc2~2^2~1 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8de7563acd813e742bcf7db0a6ab19203dbf6b28;p=gostls13.git cmd/go: avoid use of git -C, which does not exist in RHEL 7 Tested manually with "go test -run TestGetSubmodules". Fixes #14194. Change-Id: I4f563b2b8a38f3040d7631f74a7908ab65e0860b Reviewed-on: https://go-review.googlesource.com/19154 Reviewed-by: Brad Fitzpatrick --- diff --git a/src/cmd/go/vcs.go b/src/cmd/go/vcs.go index 074dd8b2b1..342edee50d 100644 --- a/src/cmd/go/vcs.go +++ b/src/cmd/go/vcs.go @@ -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,