aboutsummaryrefslogtreecommitdiffstats
path: root/repository/repo_testing.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository/repo_testing.go')
-rw-r--r--repository/repo_testing.go24
1 files changed, 22 insertions, 2 deletions
diff --git a/repository/repo_testing.go b/repository/repo_testing.go
index 1d3a3155..4a5c48bb 100644
--- a/repository/repo_testing.go
+++ b/repository/repo_testing.go
@@ -135,7 +135,8 @@ func RepoDataTest(t *testing.T, repo RepoData) {
require.NoError(t, err)
require.Equal(t, treeHash1, treeHash1Read)
- commit2, err := repo.StoreCommitWithParent(treeHash2, commit1)
+ // commit with a parent
+ commit2, err := repo.StoreCommit(treeHash2, commit1)
require.NoError(t, err)
require.True(t, commit2.IsValid())
@@ -187,7 +188,7 @@ func RepoDataTest(t *testing.T, repo RepoData) {
// Graph
- commit3, err := repo.StoreCommitWithParent(treeHash1, commit1)
+ commit3, err := repo.StoreCommit(treeHash1, commit1)
require.NoError(t, err)
ancestorHash, err := repo.FindCommonAncestor(commit2, commit3)
@@ -237,3 +238,22 @@ func randomData() []byte {
}
return b
}
+
+func makeCommit(t *testing.T, repo RepoData, parents ...Hash) Hash {
+ blobHash, err := repo.StoreData(randomData())
+ require.NoError(t, err)
+
+ treeHash, err := repo.StoreTree([]TreeEntry{
+ {
+ ObjectType: Blob,
+ Hash: blobHash,
+ Name: "foo",
+ },
+ })
+ require.NoError(t, err)
+
+ commitHash, err := repo.StoreCommit(treeHash, parents...)
+ require.NoError(t, err)
+
+ return commitHash
+}