gitCmd runs a git command in the given directory and fails the test on error.
(t *testing.T, dir string, args ...string)
| 26 | // gitCmd runs a git command in the given directory and fails the test |
| 27 | // on error. |
| 28 | func gitCmd(t *testing.T, dir string, args ...string) { |
| 29 | t.Helper() |
| 30 | cmd := exec.Command("git", args...) |
| 31 | cmd.Dir = dir |
| 32 | cmd.Env = append(os.Environ(), |
| 33 | "GIT_AUTHOR_NAME=Test", |
| 34 | "GIT_AUTHOR_EMAIL=test@test.com", |
| 35 | "GIT_COMMITTER_NAME=Test", |
| 36 | "GIT_COMMITTER_EMAIL=test@test.com", |
| 37 | ) |
| 38 | out, err := cmd.CombinedOutput() |
| 39 | require.NoError(t, err, "git %v: %s", args, out) |
| 40 | } |
| 41 | |
| 42 | // initTestRepo creates a temporary git repo with an initial commit |
| 43 | // and returns the repo root path. |
no test coverage detected