MCPcopy
hub / github.com/github/git-sizer / GitCommand

Method GitCommand

internal/testutils/repoutils.go:143–153  ·  view source on GitHub ↗

GitCommand creates an `*exec.Cmd` for running `git` in `repo` with the specified arguments.

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

Source from the content-addressed store, hash-verified

141// GitCommand creates an `*exec.Cmd` for running `git` in `repo` with
142// the specified arguments.
143func (repo *TestRepo) GitCommand(t *testing.T, args ...string) *exec.Cmd {
144 t.Helper()
145
146 gitArgs := []string{"-C", repo.Path}
147 gitArgs = append(gitArgs, args...)
148
149 //nolint:gosec // The args all come from the test code.
150 cmd := exec.Command("git", gitArgs...)
151 cmd.Env = CleanGitEnv()
152 return cmd
153}
154
155// UpdateRef updates the reference named `refname` to the value `oid`.
156func (repo *TestRepo) UpdateRef(t *testing.T, refname string, oid git.OID) {

Callers 8

TestTaggedTagsFunction · 0.95
TestFromSubdirFunction · 0.95
TestSubmoduleFunction · 0.95
CloneMethod · 0.95
UpdateRefMethod · 0.95
CreateObjectMethod · 0.95
AddFileMethod · 0.95
ConfigAddMethod · 0.95

Calls 1

CleanGitEnvFunction · 0.85

Tested by 3

TestTaggedTagsFunction · 0.76
TestFromSubdirFunction · 0.76
TestSubmoduleFunction · 0.76