diff options
author | Russell Belfer <rb@github.com> | 2013-09-06 02:06:42 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-09-17 20:31:46 +0400 |
commit | 155fa2342d838bdb2aa873c95a42e091351bb69a (patch) | |
tree | 4441514a2ad0b4cb2c0e088e03864b9d9f7acbe6 /tests-clar/diff | |
parent | 13f36ffb9e1c4fb70b44a477d716873fecfc0407 (diff) |
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/diff')
-rw-r--r-- | tests-clar/diff/submodules.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/tests-clar/diff/submodules.c b/tests-clar/diff/submodules.c index 167dedfc6..036ff09aa 100644 --- a/tests-clar/diff/submodules.c +++ b/tests-clar/diff/submodules.c @@ -228,11 +228,11 @@ void test_diff_submodules__invalid_cache(void) "<END>" }; static const char *expected_moved[] = { - "diff --git a/sm_changed_head b/sm_changed_head\nindex 3d9386c..0910a13 160000\n--- a/sm_changed_head\n+++ b/sm_changed_head\n@@ -1 +1 @@\n-Subproject commit 3d9386c507f6b093471a3e324085657a3c2b4247\n+Subproject commit 0910a13dfa2210496f6c590d75bc360dd11b2a1b\n", + "diff --git a/sm_changed_head b/sm_changed_head\nindex 3d9386c..7002348 160000\n--- a/sm_changed_head\n+++ b/sm_changed_head\n@@ -1 +1 @@\n-Subproject commit 3d9386c507f6b093471a3e324085657a3c2b4247\n+Subproject commit 700234833f6ccc20d744b238612646be071acaae\n", "<END>" }; static const char *expected_moved_dirty[] = { - "diff --git a/sm_changed_head b/sm_changed_head\nindex 3d9386c..0910a13 160000\n--- a/sm_changed_head\n+++ b/sm_changed_head\n@@ -1 +1 @@\n-Subproject commit 3d9386c507f6b093471a3e324085657a3c2b4247\n+Subproject commit 0910a13dfa2210496f6c590d75bc360dd11b2a1b-dirty\n", + "diff --git a/sm_changed_head b/sm_changed_head\nindex 3d9386c..7002348 160000\n--- a/sm_changed_head\n+++ b/sm_changed_head\n@@ -1 +1 @@\n-Subproject commit 3d9386c507f6b093471a3e324085657a3c2b4247\n+Subproject commit 700234833f6ccc20d744b238612646be071acaae-dirty\n", "<END>" }; @@ -309,26 +309,7 @@ void test_diff_submodules__invalid_cache(void) git_diff_list_free(diff); /* commit changed index of submodule */ - { - git_object *parent; - git_oid tree_id, commit_id; - git_tree *tree; - git_signature *sig; - git_reference *ref; - - cl_git_pass(git_revparse_ext(&parent, &ref, smrepo, "HEAD")); - cl_git_pass(git_index_write_tree(&tree_id, smindex)); - cl_git_pass(git_index_write(smindex)); - cl_git_pass(git_tree_lookup(&tree, smrepo, &tree_id)); - cl_git_pass(git_signature_new(&sig, "Sm Test", "sm@tester.test", 1372350000, 480)); - cl_git_pass(git_commit_create_v( - &commit_id, smrepo, git_reference_name(ref), sig, sig, - NULL, "Move it", tree, 1, parent)); - git_object_free(parent); - git_tree_free(tree); - git_reference_free(ref); - git_signature_free(sig); - } + cl_repo_commit_from_index(NULL, smrepo, NULL, 1372350000, "Move it"); git_submodule_set_ignore(sm, GIT_SUBMODULE_IGNORE_DIRTY); |