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

Function NewTestRepo

internal/testutils/repoutils.go:29–42  ·  view source on GitHub ↗

NewTestRepo creates and initializes a test repository in a temporary directory constructed using `pattern`. The caller must delete the repository by calling `repo.Remove()`.

(t *testing.T, bare bool, pattern string)

Source from the content-addressed store, hash-verified

27// temporary directory constructed using `pattern`. The caller must
28// delete the repository by calling `repo.Remove()`.
29func NewTestRepo(t *testing.T, bare bool, pattern string) *TestRepo {
30 t.Helper()
31
32 path, err := ioutil.TempDir("", pattern)
33 require.NoError(t, err)
34
35 repo := TestRepo{Path: path}
36
37 repo.Init(t, bare)
38
39 return &TestRepo{
40 Path: path,
41 }
42}
43
44// Init initializes a git repository at `repo.Path`.
45func (repo *TestRepo) Init(t *testing.T, bare bool) {

Callers 5

TestRefSelectionsFunction · 0.92
TestRefgroupsFunction · 0.92
TestBombFunction · 0.92
TestTaggedTagsFunction · 0.92
TestFromSubdirFunction · 0.92

Calls 1

InitMethod · 0.95

Tested by 5

TestRefSelectionsFunction · 0.74
TestRefgroupsFunction · 0.74
TestBombFunction · 0.74
TestTaggedTagsFunction · 0.74
TestFromSubdirFunction · 0.74