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 <bradfitz@golang.org>
This commit is contained in:
Russ Cox 2016-02-02 10:10:27 -05:00
parent 1c6a35b4fe
commit 8de7563acd
1 changed files with 10 additions and 1 deletions

View 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,