MCPcopy Index your code
hub / github.com/coder/coder / gitCmd

Function gitCmd

agent/agentgit/agentgit_test.go:28–40  ·  view source on GitHub ↗

gitCmd runs a git command in the given directory and fails the test on error.

(t *testing.T, dir string, args ...string)

Source from the content-addressed store, hash-verified

26// gitCmd runs a git command in the given directory and fails the test
27// on error.
28func 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.

Calls 3

CommandMethod · 0.80
HelperMethod · 0.65
EnvironMethod · 0.65

Tested by

no test coverage detected