Skip to content

Commit

Permalink
sweet/harnesses: don't swallow git stderr
Browse files Browse the repository at this point in the history
Change-Id: I8ad1a29afc9a7784659fa08f04aeaaf48f30c1c3
Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/600059
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Michael Knyszek <[email protected]>
Auto-Submit: Austin Clements <[email protected]>
  • Loading branch information
aclements authored and gopherbot committed Jul 22, 2024
1 parent 13000c5 commit 269c3a4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sweet/harnesses/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,35 @@ import (
func gitShallowClone(dir, url, ref string) error {
cmd := exec.Command("git", "clone", "--depth", "1", "-b", ref, url, dir)
log.TraceCommand(cmd, false)
cmd.Stderr = os.Stderr
_, err := cmd.Output()
return err
}

func gitRecursiveCloneToCommit(dir, url, branch, hash string) error {
cloneCmd := exec.Command("git", "clone", "--recursive", "--shallow-submodules", "-b", branch, url, dir)
log.TraceCommand(cloneCmd, false)
cloneCmd.Stderr = os.Stderr
if _, err := cloneCmd.Output(); err != nil {
return err
}
checkoutCmd := exec.Command("git", "-C", dir, "checkout", hash)
log.TraceCommand(checkoutCmd, false)
checkoutCmd.Stderr = os.Stderr
_, err := checkoutCmd.Output()
return err
}

func gitCloneToCommit(dir, url, branch, hash string) error {
cloneCmd := exec.Command("git", "clone", "-b", branch, url, dir)
log.TraceCommand(cloneCmd, false)
cloneCmd.Stderr = os.Stderr
if _, err := cloneCmd.Output(); err != nil {
return err
}
checkoutCmd := exec.Command("git", "-C", dir, "checkout", hash)
log.TraceCommand(checkoutCmd, false)
checkoutCmd.Stderr = os.Stderr
_, err := checkoutCmd.Output()
return err
}
Expand Down

0 comments on commit 269c3a4

Please sign in to comment.