diff options
author | Michael Muré <batolettre@gmail.com> | 2021-01-03 23:59:25 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2021-02-14 12:19:00 +0100 |
commit | 8d63c983c982f93cc48d3996d6bd097ddeeb327f (patch) | |
tree | 94d85594e11965f9780df53a5c0c2b2550c02184 /repository/repo_testing.go | |
parent | 4ef92efeb905102d37b81fafa0ac2173594ef30a (diff) | |
download | git-bug-8d63c983c982f93cc48d3996d6bd097ddeeb327f.tar.gz |
WIP
Diffstat (limited to 'repository/repo_testing.go')
-rw-r--r-- | repository/repo_testing.go | 24 |
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 +} |