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

Change-Id: I47b09ed307bb2cf4159b375171de0d393a017d3d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43994
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
diff --git a/tests/regres/git/git.go b/tests/regres/git/git.go
index 33352b2..82db614 100644
--- a/tests/regres/git/git.go
+++ b/tests/regres/git/git.go
@@ -57,9 +57,9 @@
 }
 
 // Add calls 'git add <file>'.
-func Add(project, file string) error {
-	if err := shell.Shell(gitTimeout, exe, project, "add", file); err != nil {
-		return err
+func Add(wd, file string) error {
+	if err := shell.Shell(gitTimeout, exe, wd, "add", file); err != nil {
+		return cause.Wrap(err, "`git add %v` in working directory %v failed", file, wd)
 	}
 	return nil
 }
@@ -71,7 +71,7 @@
 }
 
 // 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{}
 	if flags.Name != "" {
 		args = append(args, "-c", "user.name="+flags.Name)
@@ -80,7 +80,7 @@
 		args = append(args, "-c", "user.email="+flags.Email)
 	}
 	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
@@ -90,7 +90,7 @@
 }
 
 // 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{}
 	if flags.Username != "" {
 		f, err := ioutil.TempFile("", "regres-cookies.txt")
@@ -108,7 +108,7 @@
 		args = append(args, "-c", "http.cookiefile="+f.Name())
 	}
 	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.