aboutsummaryrefslogtreecommitdiff
path: root/difftrees_test.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-02-20 12:41:18 +0800
committerGravatar Runxi Yu2026-02-20 12:57:31 +0800
commite0e56e63defc1cb9cc14081c62bb268de7e15dd7 (patch)
tree9698d7daecb4775f500ac937646814a7a25bbe04 /difftrees_test.go
parentRevert "packed: Factor out packWriteObjects and clean up" (diff)
signatureNo signature
Revert "test: Make gitCmd accept an stdin []byte"
This reverts commit f762271dbfc121eaac7eb59c0beb01620a09118f.
Diffstat (limited to 'difftrees_test.go')
-rw-r--r--difftrees_test.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/difftrees_test.go b/difftrees_test.go
index 6defd96e..b8b89bb0 100644
--- a/difftrees_test.go
+++ b/difftrees_test.go
@@ -22,26 +22,26 @@ func TestDiffTreesComplexNestedChanges(t *testing.T) {
writeTestFile(t, filepath.Join(workDir, "treeB", "legacy.txt"), "legacy root\n")
writeTestFile(t, filepath.Join(workDir, "treeB", "sub", "retired.txt"), "retired\n")
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "add", ".")
- baseTreeHash := gitCmd(t, repoPath, nil, "--work-tree="+workDir, "write-tree")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "add", ".")
+ baseTreeHash := gitCmd(t, repoPath, "--work-tree="+workDir, "write-tree")
writeTestFile(t, filepath.Join(workDir, "README.md"), "updated readme\n")
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "rm", "-f", "dir/file_a.txt")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "rm", "-f", "dir/file_a.txt")
writeTestFile(t, filepath.Join(workDir, "dir", "nested", "file_b.txt"), "beta v2\n")
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "rm", "-f", "dir/nested/deeper/old.txt")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "rm", "-f", "dir/nested/deeper/old.txt")
writeTestFile(t, filepath.Join(workDir, "dir", "nested", "deeper", "new.txt"), "new branch entry\n")
writeTestFile(t, filepath.Join(workDir, "dir", "nested", "deeper", "branch", "info.md"), "branch info\n")
writeTestFile(t, filepath.Join(workDir, "dir", "nested", "deeper", "branch", "subbranch", "leaf.txt"), "leaf data\n")
writeTestFile(t, filepath.Join(workDir, "dir", "nested", "deeper", "branch", "subbranch", "deep", "final.txt"), "final artifact\n")
writeTestFile(t, filepath.Join(workDir, "dir", "newchild.txt"), "brand new sibling\n")
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "rm", "-r", "-f", "treeB")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "rm", "-r", "-f", "treeB")
writeTestFile(t, filepath.Join(workDir, "features", "alpha", "README.md"), "alpha docs\n")
writeTestFile(t, filepath.Join(workDir, "features", "alpha", "beta", "gamma.txt"), "gamma payload\n")
writeTestFile(t, filepath.Join(workDir, "modules", "v2", "core", "main.go"), "package core\n")
writeTestFile(t, filepath.Join(workDir, "root_addition.txt"), "root level file\n")
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "add", ".")
- updatedTreeHash := gitCmd(t, repoPath, nil, "--work-tree="+workDir, "write-tree")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "add", ".")
+ updatedTreeHash := gitCmd(t, repoPath, "--work-tree="+workDir, "write-tree")
repo, err := OpenRepository(repoPath)
if err != nil {
@@ -108,16 +108,16 @@ func TestDiffTreesDirectoryAddDeleteDeep(t *testing.T) {
writeTestFile(t, filepath.Join(workDir, "old_dir", "sub1", "legacy.txt"), "legacy path\n")
writeTestFile(t, filepath.Join(workDir, "old_dir", "sub1", "nested", "end.txt"), "legacy end\n")
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "add", ".")
- originalTreeHash := gitCmd(t, repoPath, nil, "--work-tree="+workDir, "write-tree")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "add", ".")
+ originalTreeHash := gitCmd(t, repoPath, "--work-tree="+workDir, "write-tree")
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "rm", "-r", "-f", "old_dir")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "rm", "-r", "-f", "old_dir")
writeTestFile(t, filepath.Join(workDir, "fresh", "alpha", "beta", "new.txt"), "brand new directory\n")
writeTestFile(t, filepath.Join(workDir, "fresh", "alpha", "docs", "note.md"), "docs note\n")
writeTestFile(t, filepath.Join(workDir, "fresh", "alpha", "beta", "gamma", "delta.txt"), "delta payload\n")
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "add", ".")
- nextTreeHash := gitCmd(t, repoPath, nil, "--work-tree="+workDir, "write-tree")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "add", ".")
+ nextTreeHash := gitCmd(t, repoPath, "--work-tree="+workDir, "write-tree")
repo, err := OpenRepository(repoPath)
if err != nil {