diff options
| author | HÃ¥vard Haugen <havard.haugen@gmail.com> | 2015-05-12 10:08:15 +0200 |
|---|---|---|
| committer | Andrew Gerrand <adg@golang.org> | 2016-03-02 05:52:12 +0000 |
| commit | 94eab3f14300ffa8355326996a9433acac1b71de (patch) | |
| tree | 57748650f8b66e0b76250f76fe63aa9a24e4c574 | |
| parent | b356792b0438274f1abae46e11c9b3397f5c233b (diff) | |
| download | go-x-review-94eab3f14300ffa8355326996a9433acac1b71de.tar.xz | |
git-codereview: print git version when test fails to execute command
Sample output when modifying one of the git commands:
--- FAIL: TestSync (0.36s)
util_test.go:250: git-codereview change work
util_test.go:250: git-codereview sync
util_test.go:207: in git-client/, ran [git add --does-not-exist file1] with git version 1.9.1:
exit status 129
error: unknown option `does-not-exist'
usage: git add [options] [--] <pathspec>...
-n, --dry-run dry run
-v, --verbose be verbose
-i, --interactive interactive picking
-p, --patch select hunks interactively
-e, --edit edit current diff and apply
-f, --force allow adding otherwise ignored files
-u, --update update tracked files
-N, --intent-to-add record only the fact that the path will be added later
-A, --all add changes from all tracked and untracked files
--ignore-removal ignore paths removed in the working tree (same as --no-all)
--refresh don't add, only refresh the index
--ignore-errors just skip files which cannot be added because of errors
--ignore-missing check if - even missing - files are ignored in dry run
Updates golang/go#9602.
Change-Id: Ibeb93b1f3f4da43d1f95fd0eb5f2c372210cd6b3
Reviewed-on: https://go-review.googlesource.com/9952
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
| -rw-r--r-- | git-codereview/util_test.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/git-codereview/util_test.go b/git-codereview/util_test.go index a0ff469..f3d06df 100644 --- a/git-codereview/util_test.go +++ b/git-codereview/util_test.go @@ -20,6 +20,8 @@ import ( "testing" ) +var gitversion = "unknown git version" // git version for error logs + type gitTest struct { pwd string // current directory before test tmpdir string // temporary directory holding repos @@ -123,6 +125,8 @@ func newGitTest(t *testing.T) (gt *gitTest) { } }() + gitversion = trun(t, tmpdir, "git", "--version") + server := tmpdir + "/git-origin" mkdir(t, server) @@ -227,6 +231,9 @@ func trun(t *testing.T, dir string, cmdline ...string) string { cmd.Dir = dir out, err := cmd.CombinedOutput() if err != nil { + if cmdline[0] == "git" { + t.Fatalf("in %s/, ran %s with %s:\n%v\n%s", filepath.Base(dir), cmdline, gitversion, err, out) + } t.Fatalf("in %s/, ran %s: %v\n%s", filepath.Base(dir), cmdline, err, out) } return string(out) |
