diff options
| author | 2026-01-30 17:10:01 +0100 | |
|---|---|---|
| committer | 2026-01-30 17:10:01 +0100 | |
| commit | f762271dbfc121eaac7eb59c0beb01620a09118f (patch) | |
| tree | 7abee7bf666227312088cdb112f6557864adaecb /reachability_test.go | |
| parent | packed, delta: Implement thin packs (diff) | |
| signature | No signature | |
test: Make gitCmd accept an stdin []byte
Diffstat (limited to 'reachability_test.go')
| -rw-r--r-- | reachability_test.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/reachability_test.go b/reachability_test.go index 2a2d5060..4c32b9cd 100644 --- a/reachability_test.go +++ b/reachability_test.go @@ -20,9 +20,9 @@ func TestReachabilityCommitsWantHave(t *testing.T) { if err := os.WriteFile(path, []byte{byte('a' + i), '\n'}, 0o644); err != nil { t.Fatalf("write file: %v", err) } - gitCmd(t, repoPath, "--work-tree="+workDir, "add", ".") - gitCmd(t, repoPath, "--work-tree="+workDir, "commit", "-m", "commit") - commits = append(commits, gitCmd(t, repoPath, "rev-parse", "HEAD")) + gitCmd(t, repoPath, nil, "--work-tree="+workDir, "add", ".") + gitCmd(t, repoPath, nil, "--work-tree="+workDir, "commit", "-m", "commit") + commits = append(commits, gitCmd(t, repoPath, nil, "rev-parse", "HEAD")) } repo, err := OpenRepository(repoPath) @@ -97,8 +97,8 @@ func TestReachabilityAllObjects(t *testing.T) { if err := os.WriteFile(filepath.Join(workDir, "dir", "file2.txt"), []byte("two\n"), 0o644); err != nil { t.Fatalf("write file2: %v", err) } - gitCmd(t, repoPath, "--work-tree="+workDir, "add", ".") - gitCmd(t, repoPath, "--work-tree="+workDir, "commit", "-m", "commit") + gitCmd(t, repoPath, nil, "--work-tree="+workDir, "add", ".") + gitCmd(t, repoPath, nil, "--work-tree="+workDir, "commit", "-m", "commit") repo, err := OpenRepository(repoPath) if err != nil { @@ -106,7 +106,7 @@ func TestReachabilityAllObjects(t *testing.T) { } defer func() { _ = repo.Close() }() - head := gitCmd(t, repoPath, "rev-parse", "HEAD") + head := gitCmd(t, repoPath, nil, "rev-parse", "HEAD") wantID, _ := repo.ParseHash(head) walk, err := repo.ReachableObjects(ReachabilityQuery{ Wants: []Hash{wantID}, @@ -124,9 +124,9 @@ func TestReachabilityAllObjects(t *testing.T) { t.Fatalf("Reachability walk error: %v", err) } - treeStr := gitCmd(t, repoPath, "show", "-s", "--format=%T", head) + treeStr := gitCmd(t, repoPath, nil, "show", "-s", "--format=%T", head) treeID, _ := repo.ParseHash(treeStr) - lsTree := gitCmd(t, repoPath, "ls-tree", "-r", treeStr) + lsTree := gitCmd(t, repoPath, nil, "ls-tree", "-r", treeStr) fields := strings.Fields(lsTree) if len(fields) < 3 { t.Fatalf("unexpected ls-tree output: %q", lsTree) @@ -157,9 +157,9 @@ func TestReachabilityStopAtHaves(t *testing.T) { if err := os.WriteFile(path, []byte{byte('a' + i), '\n'}, 0o644); err != nil { t.Fatalf("write file: %v", err) } - gitCmd(t, repoPath, "--work-tree="+workDir, "add", ".") - gitCmd(t, repoPath, "--work-tree="+workDir, "commit", "-m", "commit") - commits = append(commits, gitCmd(t, repoPath, "rev-parse", "HEAD")) + gitCmd(t, repoPath, nil, "--work-tree="+workDir, "add", ".") + gitCmd(t, repoPath, nil, "--work-tree="+workDir, "commit", "-m", "commit") + commits = append(commits, gitCmd(t, repoPath, nil, "rev-parse", "HEAD")) } repo, err := OpenRepository(repoPath) |
