MCPcopy Create free account
hub / github.com/rilldata/rill / setupMirrorSourceRepo

Function setupMirrorSourceRepo

admin/server/github_test.go:28–48  ·  view source on GitHub ↗

setupMirrorSourceRepo creates a local git repository with commits on two branches and a tag.

(t *testing.T)

Source from the content-addressed store, hash-verified

26
27// setupMirrorSourceRepo creates a local git repository with commits on two branches and a tag.
28func setupMirrorSourceRepo(t *testing.T) string {
29 t.Helper()
30 dir := t.TempDir()
31 runGitCommand(t, dir, "init")
32 runGitCommand(t, dir, "checkout", "-b", "main")
33 runGitCommand(t, dir, "config", "user.name", "Test User")
34 runGitCommand(t, dir, "config", "user.email", "test@example.com")
35
36 err := os.WriteFile(filepath.Join(dir, "readme.txt"), []byte("hello"), 0644)
37 require.NoError(t, err)
38 runGitCommand(t, dir, "add", "readme.txt")
39 runGitCommand(t, dir, "commit", "-m", "initial commit")
40 runGitCommand(t, dir, "tag", "v1.0")
41
42 runGitCommand(t, dir, "checkout", "-b", "feature")
43 err = os.WriteFile(filepath.Join(dir, "feature.txt"), []byte("feature"), 0644)
44 require.NoError(t, err)
45 runGitCommand(t, dir, "add", "feature.txt")
46 runGitCommand(t, dir, "commit", "-m", "add feature")
47 return dir
48}
49
50func runGitCommand(t *testing.T, dir string, args ...string) string {
51 t.Helper()

Callers 1

TestMirrorGitRepoFunction · 0.85

Calls 2

runGitCommandFunction · 0.85
TempDirMethod · 0.65

Tested by

no test coverage detected