Previously, we were simply cascading the error returned by the instance of exec.Command. However, that winds up just being something of the form "exit status 128", with all of the real error message going to the Stderr field.

As such, this commit changes the behavior to save the data written to stderr, and use it to construct a new error to return.

Modified repository/git.go

@@ -18,6 +18,7 @@ limitations under the License.
package repository
import (
@@ -37,7 +38,13 @@ type GitRepo struct {
func (repo *GitRepo) runGitCommand(args ...string) (string, error) {
cmd := exec.Command("git", args...)
cmd.Dir = repo.Path
var stderr bytes.Buffer
cmd.Stderr = &stderr
out, err := cmd.Output()
if err != nil {
errorMessage := strings.TrimSpace(stderr.String())
err = fmt.Errorf(errorMessage)
return strings.Trim(string(out), "\n"), err