MCPcopy Create free account
hub / github.com/github/gh-aw / runGit

Function runGit

pkg/cli/add_interactive_git_test.go:153–165  ·  view source on GitHub ↗

runGit executes a git command in the given directory, failing the test on error.

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

Source from the content-addressed store, hash-verified

151
152// runGit executes a git command in the given directory, failing the test on error.
153func 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).
168func runGitIn(t *testing.T, dir string, args ...string) {

Calls

no outgoing calls

Tested by

no test coverage detected