runGit executes a git command in the given directory, failing the test on error.
(t *testing.T, dir string, args ...string)
| 151 | |
| 152 | // runGit executes a git command in the given directory, failing the test on error. |
| 153 | func runGit(t *testing.T, dir string, args ...string) { |
| 154 | t.Helper() |
| 155 | cmd := exec.Command("git", args...) |
| 156 | cmd.Dir = dir |
| 157 | cmd.Env = append(os.Environ(), |
| 158 | "GIT_AUTHOR_NAME=test", |
| 159 | "GIT_AUTHOR_EMAIL=test@test.com", |
| 160 | "GIT_COMMITTER_NAME=test", |
| 161 | "GIT_COMMITTER_EMAIL=test@test.com", |
| 162 | ) |
| 163 | out, err := cmd.CombinedOutput() |
| 164 | require.NoError(t, err, "git %s failed: %s", strings.Join(args, " "), string(out)) |
| 165 | } |
| 166 | |
| 167 | // runGitIn executes a git command with no specific dir (or empty string for cwd). |
| 168 | func runGitIn(t *testing.T, dir string, args ...string) { |
no outgoing calls
no test coverage detected