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

Function gitOut

internal/diff/git_resolve_test.go:17–26  ·  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

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

Calls 1

OutputMethod · 0.80

Tested by

no test coverage detected