Commit 8de7563a authored by Russ Cox's avatar Russ Cox

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/19154Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 1c6a35b4
...@@ -122,7 +122,7 @@ var vcsGit = &vcsCmd{ ...@@ -122,7 +122,7 @@ var vcsGit = &vcsCmd{
name: "Git", name: "Git",
cmd: "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"}, downloadCmd: []string{"pull --ff-only", "submodule update --init --recursive"},
tagCmd: []tagCmd{ tagCmd: []tagCmd{
...@@ -335,6 +335,15 @@ func (v *vcsCmd) run1(dir string, cmdline string, keyval []string, verbose bool) ...@@ -335,6 +335,15 @@ func (v *vcsCmd) run1(dir string, cmdline string, keyval []string, verbose bool)
args[i] = expand(m, arg) 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) _, err := exec.LookPath(v.cmd)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, fmt.Fprintf(os.Stderr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment