MCPcopy Create free account
hub / github.com/alibaba/open-code-review / gitOut

Function gitOut

internal/diff/git_resolve_test.go:14–23  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
14func 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.

Calls 1

OutputMethod · 0.80

Tested by

no test coverage detected