summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2014-05-03 19:13:32 +0200
committerCarlos Martín Nieto <[email protected]>2014-05-03 19:13:32 +0200
commit9b4c865f18d0c6241b228621f557840159119ef6 (patch)
treea225a3e888f74e8172a077f0ca2263274966380d
parent9c72700765ed2459968a40f6cc1ddf41488f2465 (diff)
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.
-rw-r--r--git_test.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/git_test.go b/git_test.go
index cbf3227..56adeed 100644
--- a/git_test.go
+++ b/git_test.go
@@ -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