aboutsummaryrefslogtreecommitdiff
path: root/obj_commit_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 /obj_commit_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 'obj_commit_test.go')
-rw-r--r--obj_commit_test.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/obj_commit_test.go b/obj_commit_test.go
index 6e8a2dc1..939385d5 100644
--- a/obj_commit_test.go
+++ b/obj_commit_test.go
@@ -87,9 +87,9 @@ func TestCommitRead(t *testing.T) {
if err != nil {
t.Fatalf("failed to write file.txt: %v", err)
}
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "add", ".")
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "commit", "-m", "Test commit")
- commitHash := gitCmd(t, repoPath, nil, "rev-parse", "HEAD")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "add", ".")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "commit", "-m", "Test commit")
+ commitHash := gitCmd(t, repoPath, "rev-parse", "HEAD")
repo, err := OpenRepository(repoPath)
if err != nil {
@@ -135,24 +135,24 @@ func TestCommitWithParents(t *testing.T) {
if err != nil {
t.Fatalf("failed to write file1.txt: %v", err)
}
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "add", ".")
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "commit", "-m", "First commit")
- parent1Hash := gitCmd(t, repoPath, nil, "rev-parse", "HEAD")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "add", ".")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "commit", "-m", "First commit")
+ parent1Hash := gitCmd(t, repoPath, "rev-parse", "HEAD")
err = os.WriteFile(filepath.Join(workDir, "file2.txt"), []byte("content2"), 0o644)
if err != nil {
t.Fatalf("failed to write file2.txt: %v", err)
}
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "add", ".")
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "commit", "-m", "Second commit")
- parent2Hash := gitCmd(t, repoPath, nil, "rev-parse", "HEAD")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "add", ".")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "commit", "-m", "Second commit")
+ parent2Hash := gitCmd(t, repoPath, "rev-parse", "HEAD")
err = os.WriteFile(filepath.Join(workDir, "file3.txt"), []byte("content3"), 0o644)
if err != nil {
t.Fatalf("failed to write file3.txt: %v", err)
}
- gitCmd(t, repoPath, nil, "--work-tree="+workDir, "add", ".")
- treeHash := gitCmd(t, repoPath, nil, "--work-tree="+workDir, "write-tree")
+ gitCmd(t, repoPath, "--work-tree="+workDir, "add", ".")
+ treeHash := gitCmd(t, repoPath, "--work-tree="+workDir, "write-tree")
mergeCommitData := fmt.Sprintf("tree %s\nparent %s\nparent %s\nauthor Test Author <test@example.org> 1234567890 +0000\ncommitter Test Committer <committer@example.org> 1234567890 +0000\n\nMerge commit\n",
treeHash, parent1Hash, parent2Hash)