gitOut runs a git command in dir and returns its trimmed stdout, failing the test on error. Used to capture the SHAs a ResolveInput result must match.
(t *testing.T, dir string, args ...string)
| 12 | // gitOut runs a git command in dir and returns its trimmed stdout, failing the |
| 13 | // test on error. Used to capture the SHAs a ResolveInput result must match. |
| 14 | func gitOut(t *testing.T, dir string, args ...string) string { |
| 15 | t.Helper() |
| 16 | cmd := exec.Command("git", args...) |
| 17 | cmd.Dir = dir |
| 18 | out, err := cmd.Output() |
| 19 | if err != nil { |
| 20 | t.Fatalf("git %v failed: %v", args, err) |
| 21 | } |
| 22 | return strings.TrimSpace(string(out)) |
| 23 | } |
| 24 | |
| 25 | // initBareRepo creates an empty (unborn) git repository with identity configured |
| 26 | // but no commits, returning the repo dir. |
no test coverage detected