test: adjust to safe commit append
When we create a commit and tell the library to update a ref, we need to make sure to pass the current tip. This is what we should have been doing in a function called 'upateReadme()' anyway. The existing code creates a new root commit, which is not an update.
This commit is contained in:
parent
9c72700765
commit
9b4c865f18
|
@ -77,10 +77,15 @@ func updateReadme(t *testing.T, repo *Repository, content string) (*Oid, *Oid) {
|
|||
treeId, err := idx.WriteTree()
|
||||
checkFatal(t, err)
|
||||
|
||||
currentBranch, err := repo.Head()
|
||||
checkFatal(t, err)
|
||||
currentTip, err := repo.LookupCommit(currentBranch.Target())
|
||||
checkFatal(t, err)
|
||||
|
||||
message := "This is a commit\n"
|
||||
tree, err := repo.LookupTree(treeId)
|
||||
checkFatal(t, err)
|
||||
commitId, err := repo.CreateCommit("HEAD", sig, sig, message, tree)
|
||||
commitId, err := repo.CreateCommit("HEAD", sig, sig, message, tree, currentTip)
|
||||
checkFatal(t, err)
|
||||
|
||||
return commitId, treeId
|
||||
|
|
Loading…
Reference in New Issue