summaryrefslogtreecommitdiff
path: root/tests-clar/status/worktree.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-09-05 15:06:42 -0700
committerRussell Belfer <rb@github.com>2013-09-17 09:31:46 -0700
commit155fa2342d838bdb2aa873c95a42e091351bb69a (patch)
tree4441514a2ad0b4cb2c0e088e03864b9d9f7acbe6 /tests-clar/status/worktree.c
parent13f36ffb9e1c4fb70b44a477d716873fecfc0407 (diff)
downloadlibgit2-155fa2342d838bdb2aa873c95a42e091351bb69a.tar.gz
Add clar helper to create new commit from index
There were a lot of places in the test code base that were creating a commit from the index on the current branch. This just adds a helper to handle that case pretty easily. There was only one test where this change ended up tweaking the test data, so pretty easy and mostly just a cleanup.
Diffstat (limited to 'tests-clar/status/worktree.c')
-rw-r--r--tests-clar/status/worktree.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/tests-clar/status/worktree.c b/tests-clar/status/worktree.c
index be7398cb6..135a95871 100644
--- a/tests-clar/status/worktree.c
+++ b/tests-clar/status/worktree.c
@@ -632,35 +632,12 @@ void test_status_worktree__conflicted_item(void)
static void stage_and_commit(git_repository *repo, const char *path)
{
- git_oid tree_oid, commit_oid;
- git_tree *tree;
- git_signature *signature;
git_index *index;
cl_git_pass(git_repository_index(&index, repo));
cl_git_pass(git_index_add_bypath(index, path));
- cl_git_pass(git_index_write(index));
-
- cl_git_pass(git_index_write_tree(&tree_oid, index));
+ cl_repo_commit_from_index(NULL, repo, NULL, 1323847743, "Initial commit\n");
git_index_free(index);
-
- cl_git_pass(git_tree_lookup(&tree, repo, &tree_oid));
-
- cl_git_pass(git_signature_new(&signature, "nulltoken", "emeric.fermas@gmail.com", 1323847743, 60));
-
- cl_git_pass(git_commit_create_v(
- &commit_oid,
- repo,
- "HEAD",
- signature,
- signature,
- NULL,
- "Initial commit\n\0",
- tree,
- 0));
-
- git_tree_free(tree);
- git_signature_free(signature);
}
static void assert_ignore_case(