Commit b1db156e by Ben Clayton

Regres: Include a better error message when git add fails.

Change-Id: I47b09ed307bb2cf4159b375171de0d393a017d3d Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43994Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent 44da431e
...@@ -57,9 +57,9 @@ func ParseHash(s string) Hash { ...@@ -57,9 +57,9 @@ func ParseHash(s string) Hash {
} }
// Add calls 'git add <file>'. // Add calls 'git add <file>'.
func Add(project, file string) error { func Add(wd, file string) error {
if err := shell.Shell(gitTimeout, exe, project, "add", file); err != nil { if err := shell.Shell(gitTimeout, exe, wd, "add", file); err != nil {
return err return cause.Wrap(err, "`git add %v` in working directory %v failed", file, wd)
} }
return nil return nil
} }
...@@ -71,7 +71,7 @@ type CommitFlags struct { ...@@ -71,7 +71,7 @@ type CommitFlags struct {
} }
// Commit calls 'git commit -m <msg> --author <author>'. // Commit calls 'git commit -m <msg> --author <author>'.
func Commit(project, msg string, flags CommitFlags) error { func Commit(wd, msg string, flags CommitFlags) error {
args := []string{} args := []string{}
if flags.Name != "" { if flags.Name != "" {
args = append(args, "-c", "user.name="+flags.Name) args = append(args, "-c", "user.name="+flags.Name)
...@@ -80,7 +80,7 @@ func Commit(project, msg string, flags CommitFlags) error { ...@@ -80,7 +80,7 @@ func Commit(project, msg string, flags CommitFlags) error {
args = append(args, "-c", "user.email="+flags.Email) args = append(args, "-c", "user.email="+flags.Email)
} }
args = append(args, "commit", "-m", msg) args = append(args, "commit", "-m", msg)
return shell.Shell(gitTimeout, exe, project, args...) return shell.Shell(gitTimeout, exe, wd, args...)
} }
// PushFlags advanced flags for Commit // PushFlags advanced flags for Commit
...@@ -90,7 +90,7 @@ type PushFlags struct { ...@@ -90,7 +90,7 @@ type PushFlags struct {
} }
// Push pushes the local branch to remote. // Push pushes the local branch to remote.
func Push(project, remote, localBranch, remoteBranch string, flags PushFlags) error { func Push(wd, remote, localBranch, remoteBranch string, flags PushFlags) error {
args := []string{} args := []string{}
if flags.Username != "" { if flags.Username != "" {
f, err := ioutil.TempFile("", "regres-cookies.txt") f, err := ioutil.TempFile("", "regres-cookies.txt")
...@@ -108,7 +108,7 @@ func Push(project, remote, localBranch, remoteBranch string, flags PushFlags) er ...@@ -108,7 +108,7 @@ func Push(project, remote, localBranch, remoteBranch string, flags PushFlags) er
args = append(args, "-c", "http.cookiefile="+f.Name()) args = append(args, "-c", "http.cookiefile="+f.Name())
} }
args = append(args, "push", remote, localBranch+":"+remoteBranch) args = append(args, "push", remote, localBranch+":"+remoteBranch)
return shell.Shell(gitTimeout, exe, project, args...) return shell.Shell(gitTimeout, exe, wd, args...)
} }
// CheckoutRemoteBranch performs a git fetch and checkout of the given branch into path. // CheckoutRemoteBranch performs a git fetch and checkout of the given branch into path.
......
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