aboutsummaryrefslogtreecommitdiff
path: root/internal/testgit/repo_make_commit.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-02-20 21:19:47 +0800
committerGravatar Runxi Yu2026-02-20 21:34:42 +0800
commit05e07f6c6aca1662c33359f41c66e6f9b6eb935a (patch)
tree6928a76783b2230a010c36d53b8da48ff24d611f /internal/testgit/repo_make_commit.go
parentoid: Add ObjectID (diff)
signatureNo signature
testgit: Add test harnesses
Diffstat (limited to 'internal/testgit/repo_make_commit.go')
-rw-r--r--internal/testgit/repo_make_commit.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/testgit/repo_make_commit.go b/internal/testgit/repo_make_commit.go
new file mode 100644
index 00000000..a329ee8a
--- /dev/null
+++ b/internal/testgit/repo_make_commit.go
@@ -0,0 +1,15 @@
+package testgit
+
+import (
+ "testing"
+
+ "codeberg.org/lindenii/furgit/oid"
+)
+
+// MakeCommit creates a commit over a single-file tree and returns (blobID, treeID, commitID).
+func (repo *TestRepo) MakeCommit(tb testing.TB, message string) (oid.ObjectID, oid.ObjectID, oid.ObjectID) {
+ tb.Helper()
+ blobID, treeID := repo.MakeSingleFileTree(tb, "file.txt", []byte("commit-body\n"))
+ commitID := repo.CommitTree(tb, treeID, message)
+ return blobID, treeID, commitID
+}