From 9b4c865f18d0c6241b228621f557840159119ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 3 May 2014 19:13:32 +0200 Subject: [PATCH] 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. --- git_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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