diff options
author | Edward Thomson <ethomson@microsoft.com> | 2014-10-03 19:02:29 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2014-10-26 22:59:48 -0400 |
commit | 18b00406c6427eb8c9d96864448474e1d85017de (patch) | |
tree | ee02fd12ee4b8f84e5ed53ca59ac771734bba16e /tests/merge | |
parent | 796b03bd4969f170d8e7a7c9edd567f636b58cb3 (diff) | |
download | libgit2-18b00406c6427eb8c9d96864448474e1d85017de.tar.gz |
s/git_merge_head/git_annotated_commit
Rename git_merge_head to git_annotated_commit, as it becomes used
in more operations than just merge.
Diffstat (limited to 'tests/merge')
-rw-r--r-- | tests/merge/merge_helpers.c | 9 | ||||
-rw-r--r-- | tests/merge/workdir/analysis.c | 9 | ||||
-rw-r--r-- | tests/merge/workdir/dirty.c | 8 | ||||
-rw-r--r-- | tests/merge/workdir/setup.c | 472 | ||||
-rw-r--r-- | tests/merge/workdir/simple.c | 40 | ||||
-rw-r--r-- | tests/merge/workdir/submodules.c | 16 | ||||
-rw-r--r-- | tests/merge/workdir/trivial.c | 8 |
7 files changed, 282 insertions, 280 deletions
diff --git a/tests/merge/merge_helpers.c b/tests/merge/merge_helpers.c index e3e703943..9a6ead984 100644 --- a/tests/merge/merge_helpers.c +++ b/tests/merge/merge_helpers.c @@ -6,6 +6,7 @@ #include "merge.h" #include "git2/merge.h" #include "git2/sys/index.h" +#include "git2/annotated_commit.h" int merge_trees_from_branches( git_index **index, git_repository *repo, @@ -84,7 +85,7 @@ int merge_branches(git_repository *repo, git_merge_options *merge_opts, git_checkout_options *checkout_opts) { git_reference *head_ref, *theirs_ref; - git_merge_head *theirs_head; + git_annotated_commit *theirs_head; git_checkout_options head_checkout_opts = GIT_CHECKOUT_OPTIONS_INIT; head_checkout_opts.checkout_strategy = GIT_CHECKOUT_FORCE; @@ -93,13 +94,13 @@ int merge_branches(git_repository *repo, cl_git_pass(git_checkout_head(repo, &head_checkout_opts)); cl_git_pass(git_reference_lookup(&theirs_ref, repo, theirs_branch)); - cl_git_pass(git_merge_head_from_ref(&theirs_head, repo, theirs_ref)); + cl_git_pass(git_annotated_commit_from_ref(&theirs_head, repo, theirs_ref)); - cl_git_pass(git_merge(repo, (const git_merge_head **)&theirs_head, 1, merge_opts, checkout_opts)); + cl_git_pass(git_merge(repo, (const git_annotated_commit **)&theirs_head, 1, merge_opts, checkout_opts)); git_reference_free(head_ref); git_reference_free(theirs_ref); - git_merge_head_free(theirs_head); + git_annotated_commit_free(theirs_head); return 0; } diff --git a/tests/merge/workdir/analysis.c b/tests/merge/workdir/analysis.c index 85918abe4..351cfbdd5 100644 --- a/tests/merge/workdir/analysis.c +++ b/tests/merge/workdir/analysis.c @@ -1,6 +1,7 @@ #include "clar_libgit2.h" #include "git2/repository.h" #include "git2/merge.h" +#include "git2/annotated_commit.h" #include "git2/sys/index.h" #include "merge.h" #include "../merge_helpers.h" @@ -43,17 +44,17 @@ static void analysis_from_branch( { git_buf refname = GIT_BUF_INIT; git_reference *their_ref; - git_merge_head *their_head; + git_annotated_commit *their_head; git_buf_printf(&refname, "%s%s", GIT_REFS_HEADS_DIR, branchname); cl_git_pass(git_reference_lookup(&their_ref, repo, git_buf_cstr(&refname))); - cl_git_pass(git_merge_head_from_ref(&their_head, repo, their_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_head, repo, their_ref)); - cl_git_pass(git_merge_analysis(merge_analysis, merge_pref, repo, (const git_merge_head **)&their_head, 1)); + cl_git_pass(git_merge_analysis(merge_analysis, merge_pref, repo, (const git_annotated_commit **)&their_head, 1)); git_buf_free(&refname); - git_merge_head_free(their_head); + git_annotated_commit_free(their_head); git_reference_free(their_ref); } diff --git a/tests/merge/workdir/dirty.c b/tests/merge/workdir/dirty.c index 0549b06b3..4b68b213b 100644 --- a/tests/merge/workdir/dirty.c +++ b/tests/merge/workdir/dirty.c @@ -89,18 +89,18 @@ static void set_core_autocrlf_to(git_repository *repo, bool value) static int merge_branch(void) { git_oid their_oids[1]; - git_merge_head *their_heads[1]; + git_annotated_commit *their_head; git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT; git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT; int error; cl_git_pass(git_oid_fromstr(&their_oids[0], MERGE_BRANCH_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[0], repo, &their_oids[0])); + cl_git_pass(git_annotated_commit_lookup(&their_head, repo, &their_oids[0])); checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE; - error = git_merge(repo, (const git_merge_head **)their_heads, 1, &merge_opts, &checkout_opts); + error = git_merge(repo, (const git_annotated_commit **)&their_head, 1, &merge_opts, &checkout_opts); - git_merge_head_free(their_heads[0]); + git_annotated_commit_free(their_head); return error; } diff --git a/tests/merge/workdir/setup.c b/tests/merge/workdir/setup.c index a0028ec6d..099bc1211 100644 --- a/tests/merge/workdir/setup.c +++ b/tests/merge/workdir/setup.c @@ -76,15 +76,15 @@ void test_merge_workdir_setup__one_branch(void) { git_oid our_oid; git_reference *octo1_ref; - git_merge_head *our_head, *their_heads[1]; + git_annotated_commit *our_head, *their_heads[1]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 1)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 1)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -93,8 +93,8 @@ void test_merge_workdir_setup__one_branch(void) git_reference_free(octo1_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); } /* git merge --no-ff 16f825815cfd20a07a75c71554e82d8eede0b061 */ @@ -102,23 +102,23 @@ void test_merge_workdir_setup__one_oid(void) { git_oid our_oid; git_oid octo1_oid; - git_merge_head *our_head, *their_heads[1]; + git_annotated_commit *our_head, *their_heads[1]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[0], repo, &octo1_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &octo1_oid)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 1)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 1)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff")); cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge commit '" OCTO1_OID "'\n")); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); } /* git merge octo1 octo2 */ @@ -127,18 +127,18 @@ void test_merge_workdir_setup__two_branches(void) git_oid our_oid; git_reference *octo1_ref; git_reference *octo2_ref; - git_merge_head *our_head, *their_heads[2]; + git_annotated_commit *our_head, *their_heads[2]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref)); cl_git_pass(git_reference_lookup(&octo2_ref, repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[1], repo, octo2_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 2)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 2)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -148,9 +148,9 @@ void test_merge_workdir_setup__two_branches(void) git_reference_free(octo1_ref); git_reference_free(octo2_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); } /* git merge octo1 octo2 octo3 */ @@ -160,21 +160,21 @@ void test_merge_workdir_setup__three_branches(void) git_reference *octo1_ref; git_reference *octo2_ref; git_reference *octo3_ref; - git_merge_head *our_head, *their_heads[3]; + git_annotated_commit *our_head, *their_heads[3]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref)); cl_git_pass(git_reference_lookup(&octo2_ref, repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[1], repo, octo2_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref)); cl_git_pass(git_reference_lookup(&octo3_ref, repo, GIT_REFS_HEADS_DIR OCTO3_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[2], repo, octo3_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[2], repo, octo3_ref)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 3)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 3)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n" OCTO3_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -185,10 +185,10 @@ void test_merge_workdir_setup__three_branches(void) git_reference_free(octo2_ref); git_reference_free(octo3_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); - git_merge_head_free(their_heads[2]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); + git_annotated_commit_free(their_heads[2]); } /* git merge 16f825815cfd20a07a75c71554e82d8eede0b061 158dc7bedb202f5b26502bf3574faa7f4238d56c 50ce7d7d01217679e26c55939eef119e0c93e272 */ @@ -198,31 +198,31 @@ void test_merge_workdir_setup__three_oids(void) git_oid octo1_oid; git_oid octo2_oid; git_oid octo3_oid; - git_merge_head *our_head, *their_heads[3]; + git_annotated_commit *our_head, *their_heads[3]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[0], repo, &octo1_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &octo1_oid)); cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[1], repo, &octo2_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_heads[1], repo, &octo2_oid)); cl_git_pass(git_oid_fromstr(&octo3_oid, OCTO3_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[2], repo, &octo3_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_heads[2], repo, &octo3_oid)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 3)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 3)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n" OCTO3_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff")); cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge commit '" OCTO1_OID "'; commit '" OCTO2_OID "'; commit '" OCTO3_OID "'\n")); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); - git_merge_head_free(their_heads[2]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); + git_annotated_commit_free(their_heads[2]); } /* git merge octo1 158dc7bedb202f5b26502bf3574faa7f4238d56c */ @@ -231,18 +231,18 @@ void test_merge_workdir_setup__branches_and_oids_1(void) git_oid our_oid; git_reference *octo1_ref; git_oid octo2_oid; - git_merge_head *our_head, *their_heads[2]; + git_annotated_commit *our_head, *their_heads[2]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref)); cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[1], repo, &octo2_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_heads[1], repo, &octo2_oid)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 2)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 2)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -251,9 +251,9 @@ void test_merge_workdir_setup__branches_and_oids_1(void) git_reference_free(octo1_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); } /* git merge octo1 158dc7bedb202f5b26502bf3574faa7f4238d56c octo3 54269b3f6ec3d7d4ede24dd350dd5d605495c3ae */ @@ -264,24 +264,24 @@ void test_merge_workdir_setup__branches_and_oids_2(void) git_oid octo2_oid; git_reference *octo3_ref; git_oid octo4_oid; - git_merge_head *our_head, *their_heads[4]; + git_annotated_commit *our_head, *their_heads[4]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref)); cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[1], repo, &octo2_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_heads[1], repo, &octo2_oid)); cl_git_pass(git_reference_lookup(&octo3_ref, repo, GIT_REFS_HEADS_DIR OCTO3_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[2], repo, octo3_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[2], repo, octo3_ref)); cl_git_pass(git_oid_fromstr(&octo4_oid, OCTO4_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[3], repo, &octo4_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_heads[3], repo, &octo4_oid)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 4)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 4)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n" OCTO3_OID "\n" OCTO4_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -291,11 +291,11 @@ void test_merge_workdir_setup__branches_and_oids_2(void) git_reference_free(octo1_ref); git_reference_free(octo3_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); - git_merge_head_free(their_heads[2]); - git_merge_head_free(their_heads[3]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); + git_annotated_commit_free(their_heads[2]); + git_annotated_commit_free(their_heads[3]); } /* git merge 16f825815cfd20a07a75c71554e82d8eede0b061 octo2 50ce7d7d01217679e26c55939eef119e0c93e272 octo4 */ @@ -306,24 +306,24 @@ void test_merge_workdir_setup__branches_and_oids_3(void) git_reference *octo2_ref; git_oid octo3_oid; git_reference *octo4_ref; - git_merge_head *our_head, *their_heads[4]; + git_annotated_commit *our_head, *their_heads[4]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[0], repo, &octo1_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &octo1_oid)); cl_git_pass(git_reference_lookup(&octo2_ref, repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[1], repo, octo2_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref)); cl_git_pass(git_oid_fromstr(&octo3_oid, OCTO3_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[2], repo, &octo3_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_heads[2], repo, &octo3_oid)); cl_git_pass(git_reference_lookup(&octo4_ref, repo, GIT_REFS_HEADS_DIR OCTO4_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[3], repo, octo4_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[3], repo, octo4_ref)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 4)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 4)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n" OCTO3_OID "\n" OCTO4_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -333,11 +333,11 @@ void test_merge_workdir_setup__branches_and_oids_3(void) git_reference_free(octo2_ref); git_reference_free(octo4_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); - git_merge_head_free(their_heads[2]); - git_merge_head_free(their_heads[3]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); + git_annotated_commit_free(their_heads[2]); + git_annotated_commit_free(their_heads[3]); } /* git merge 16f825815cfd20a07a75c71554e82d8eede0b061 octo2 50ce7d7d01217679e26c55939eef119e0c93e272 octo4 octo5 */ @@ -349,27 +349,27 @@ void test_merge_workdir_setup__branches_and_oids_4(void) git_oid octo3_oid; git_reference *octo4_ref; git_reference *octo5_ref; - git_merge_head *our_head, *their_heads[5]; + git_annotated_commit *our_head, *their_heads[5]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[0], repo, &octo1_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &octo1_oid)); cl_git_pass(git_reference_lookup(&octo2_ref, repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[1], repo, octo2_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref)); cl_git_pass(git_oid_fromstr(&octo3_oid, OCTO3_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[2], repo, &octo3_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_heads[2], repo, &octo3_oid)); cl_git_pass(git_reference_lookup(&octo4_ref, repo, GIT_REFS_HEADS_DIR OCTO4_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[3], repo, octo4_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[3], repo, octo4_ref)); cl_git_pass(git_reference_lookup(&octo5_ref, repo, GIT_REFS_HEADS_DIR OCTO5_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[4], repo, octo5_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[4], repo, octo5_ref)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 5)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 5)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n" OCTO3_OID "\n" OCTO4_OID "\n" OCTO5_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -380,12 +380,12 @@ void test_merge_workdir_setup__branches_and_oids_4(void) git_reference_free(octo4_ref); git_reference_free(octo5_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); - git_merge_head_free(their_heads[2]); - git_merge_head_free(their_heads[3]); - git_merge_head_free(their_heads[4]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); + git_annotated_commit_free(their_heads[2]); + git_annotated_commit_free(their_heads[3]); + git_annotated_commit_free(their_heads[4]); } /* git merge octo1 octo1 octo1 */ @@ -395,21 +395,21 @@ void test_merge_workdir_setup__three_same_branches(void) git_reference *octo1_1_ref; git_reference *octo1_2_ref; git_reference *octo1_3_ref; - git_merge_head *our_head, *their_heads[3]; + git_annotated_commit *our_head, *their_heads[3]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_reference_lookup(&octo1_1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_1_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_1_ref)); cl_git_pass(git_reference_lookup(&octo1_2_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[1], repo, octo1_2_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo1_2_ref)); cl_git_pass(git_reference_lookup(&octo1_3_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[2], repo, octo1_3_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[2], repo, octo1_3_ref)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 3)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 3)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO1_OID "\n" OCTO1_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -420,10 +420,10 @@ void test_merge_workdir_setup__three_same_branches(void) git_reference_free(octo1_2_ref); git_reference_free(octo1_3_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); - git_merge_head_free(their_heads[2]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); + git_annotated_commit_free(their_heads[2]); } /* git merge 16f825815cfd20a07a75c71554e82d8eede0b061 16f825815cfd20a07a75c71554e82d8eede0b061 16f825815cfd20a07a75c71554e82d8eede0b061 */ @@ -433,31 +433,31 @@ void test_merge_workdir_setup__three_same_oids(void) git_oid octo1_1_oid; git_oid octo1_2_oid; git_oid octo1_3_oid; - git_merge_head *our_head, *their_heads[3]; + git_annotated_commit *our_head, *their_heads[3]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_oid_fromstr(&octo1_1_oid, OCTO1_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[0], repo, &octo1_1_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &octo1_1_oid)); cl_git_pass(git_oid_fromstr(&octo1_2_oid, OCTO1_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[1], repo, &octo1_2_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_heads[1], repo, &octo1_2_oid)); cl_git_pass(git_oid_fromstr(&octo1_3_oid, OCTO1_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[2], repo, &octo1_3_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_heads[2], repo, &octo1_3_oid)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 3)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 3)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO1_OID "\n" OCTO1_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff")); cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge commit '" OCTO1_OID "'; commit '" OCTO1_OID "'; commit '" OCTO1_OID "'\n")); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); - git_merge_head_free(their_heads[2]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); + git_annotated_commit_free(their_heads[2]); } static int create_remote_tracking_branch(const char *branch_name, const char *oid_str) @@ -508,17 +508,17 @@ void test_merge_workdir_setup__remote_tracking_one_branch(void) { git_oid our_oid; git_reference *octo1_ref; - git_merge_head *our_head, *their_heads[1]; + git_annotated_commit *our_head, *their_heads[1]; cl_git_pass(create_remote_tracking_branch(OCTO1_BRANCH, OCTO1_OID)); cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 1)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 1)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -527,8 +527,8 @@ void test_merge_workdir_setup__remote_tracking_one_branch(void) git_reference_free(octo1_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); } /* git merge refs/remotes/origin/octo1 refs/remotes/origin/octo2 */ @@ -537,21 +537,21 @@ void test_merge_workdir_setup__remote_tracking_two_branches(void) git_oid our_oid; git_reference *octo1_ref; git_reference *octo2_ref; - git_merge_head *our_head, *their_heads[2]; + git_annotated_commit *our_head, *their_heads[2]; cl_git_pass(create_remote_tracking_branch(OCTO1_BRANCH, OCTO1_OID)); cl_git_pass(create_remote_tracking_branch(OCTO2_BRANCH, OCTO2_OID)); cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref)); cl_git_pass(git_reference_lookup(&octo2_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO2_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[1], repo, octo2_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 2)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 2)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -561,9 +561,9 @@ void test_merge_workdir_setup__remote_tracking_two_branches(void) git_reference_free(octo1_ref); git_reference_free(octo2_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); } /* git merge refs/remotes/origin/octo1 refs/remotes/origin/octo2 refs/remotes/origin/octo3 */ @@ -573,25 +573,25 @@ void test_merge_workdir_setup__remote_tracking_three_branches(void) git_reference *octo1_ref; git_reference *octo2_ref; git_reference *octo3_ref; - git_merge_head *our_head, *their_heads[3]; + git_annotated_commit *our_head, *their_heads[3]; cl_git_pass(create_remote_tracking_branch(OCTO1_BRANCH, OCTO1_OID)); cl_git_pass(create_remote_tracking_branch(OCTO2_BRANCH, OCTO2_OID)); cl_git_pass(create_remote_tracking_branch(OCTO3_BRANCH, OCTO3_OID)); cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref)); cl_git_pass(git_reference_lookup(&octo2_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO2_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[1], repo, octo2_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref)); cl_git_pass(git_reference_lookup(&octo3_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO3_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[2], repo, octo3_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[2], repo, octo3_ref)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 3)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 3)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n" OCTO3_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -602,10 +602,10 @@ void test_merge_workdir_setup__remote_tracking_three_branches(void) git_reference_free(octo2_ref); git_reference_free(octo3_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); - git_merge_head_free(their_heads[2]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); + git_annotated_commit_free(their_heads[2]); } /* git merge octo1 refs/remotes/origin/octo2 */ @@ -614,20 +614,20 @@ void test_merge_workdir_setup__normal_branch_and_remote_tracking_branch(void) git_oid our_oid; git_reference *octo1_ref; git_reference *octo2_ref; - git_merge_head *our_head, *their_heads[2]; + git_annotated_commit *our_head, *their_heads[2]; cl_git_pass(create_remote_tracking_branch(OCTO2_BRANCH, OCTO2_OID)); cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref)); cl_git_pass(git_reference_lookup(&octo2_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO2_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[1], repo, octo2_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 2)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 2)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -637,9 +637,9 @@ void test_merge_workdir_setup__normal_branch_and_remote_tracking_branch(void) git_reference_free(octo1_ref); git_reference_free(octo2_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); } /* git merge refs/remotes/origin/octo1 octo2 */ @@ -648,20 +648,20 @@ void test_merge_workdir_setup__remote_tracking_branch_and_normal_branch(void) git_oid our_oid; git_reference *octo1_ref; git_reference *octo2_ref; - git_merge_head *our_head, *their_heads[2]; + git_annotated_commit *our_head, *their_heads[2]; cl_git_pass(create_remote_tracking_branch(OCTO1_BRANCH, OCTO1_OID)); cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref)); cl_git_pass(git_reference_lookup(&octo2_ref, repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[1], repo, octo2_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 2)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 2)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -671,9 +671,9 @@ void test_merge_workdir_setup__remote_tracking_branch_and_normal_branch(void) git_reference_free(octo1_ref); git_reference_free(octo2_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); } /* git merge octo1 refs/remotes/origin/octo2 octo3 refs/remotes/origin/octo4 */ @@ -684,27 +684,27 @@ void test_merge_workdir_setup__two_remote_tracking_branch_and_two_normal_branche git_reference *octo2_ref; git_reference *octo3_ref; git_reference *octo4_ref; - git_merge_head *our_head, *their_heads[4]; + git_annotated_commit *our_head, *their_heads[4]; cl_git_pass(create_remote_tracking_branch(OCTO2_BRANCH, OCTO2_OID)); cl_git_pass(create_remote_tracking_branch(OCTO4_BRANCH, OCTO4_OID)); cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref)); cl_git_pass(git_reference_lookup(&octo2_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO2_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[1], repo, octo2_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[1], repo, octo2_ref)); cl_git_pass(git_reference_lookup(&octo3_ref, repo, GIT_REFS_HEADS_DIR OCTO3_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[2], repo, octo3_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[2], repo, octo3_ref)); cl_git_pass(git_reference_lookup(&octo4_ref, repo, GIT_REFS_REMOTES_DIR "origin/" OCTO4_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[3], repo, octo4_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[3], repo, octo4_ref)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 4)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 4)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n" OCTO3_OID "\n" OCTO4_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -716,11 +716,11 @@ void test_merge_workdir_setup__two_remote_tracking_branch_and_two_normal_branche git_reference_free(octo3_ref); git_reference_free(octo4_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); - git_merge_head_free(their_heads[2]); - git_merge_head_free(their_heads[3]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); + git_annotated_commit_free(their_heads[2]); + git_annotated_commit_free(their_heads[3]); } /* git pull origin branch octo1 */ @@ -728,23 +728,23 @@ void test_merge_workdir_setup__pull_one(void) { git_oid our_oid; git_oid octo1_1_oid; - git_merge_head *our_head, *their_heads[1]; + git_annotated_commit *our_head, *their_heads[1]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_oid_fromstr(&octo1_1_oid, OCTO1_OID)); - cl_git_pass(git_merge_head_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.url/repo.git", &octo1_1_oid)); + cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.url/repo.git", &octo1_1_oid)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 1)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 1)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff")); cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branch 'octo1' of http://remote.url/repo.git\n")); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); } /* git pull origin octo1 octo2 */ @@ -753,27 +753,27 @@ void test_merge_workdir_setup__pull_two(void) git_oid our_oid; git_oid octo1_oid; git_oid octo2_oid; - git_merge_head *our_head, *their_heads[2]; + git_annotated_commit *our_head, *their_heads[2]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID)); - cl_git_pass(git_merge_head_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.url/repo.git", &octo1_oid)); + cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.url/repo.git", &octo1_oid)); cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID)); - cl_git_pass(git_merge_head_from_fetchhead(&their_heads[1], repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH, "http://remote.url/repo.git", &octo2_oid)); + cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[1], repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH, "http://remote.url/repo.git", &octo2_oid)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 2)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 2)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff")); cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branches '" OCTO1_BRANCH "' and '" OCTO2_BRANCH "' of http://remote.url/repo.git\n")); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); } /* git pull origin octo1 octo2 octo3 */ @@ -783,31 +783,31 @@ void test_merge_workdir_setup__pull_three(void) git_oid octo1_oid; git_oid octo2_oid; git_oid octo3_oid; - git_merge_head *our_head, *their_heads[3]; + git_annotated_commit *our_head, *their_heads[3]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID)); - cl_git_pass(git_merge_head_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.url/repo.git", &octo1_oid)); + cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.url/repo.git", &octo1_oid)); cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID)); - cl_git_pass(git_merge_head_from_fetchhead(&their_heads[1], repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH, "http://remote.url/repo.git", &octo2_oid)); + cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[1], repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH, "http://remote.url/repo.git", &octo2_oid)); cl_git_pass(git_oid_fromstr(&octo3_oid, OCTO3_OID)); - cl_git_pass(git_merge_head_from_fetchhead(&their_heads[2], repo, GIT_REFS_HEADS_DIR OCTO3_BRANCH, "http://remote.url/repo.git", &octo3_oid)); + cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[2], repo, GIT_REFS_HEADS_DIR OCTO3_BRANCH, "http://remote.url/repo.git", &octo3_oid)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 3)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 3)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n" OCTO3_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff")); cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branches '" OCTO1_BRANCH "', '" OCTO2_BRANCH "' and '" OCTO3_BRANCH "' of http://remote.url/repo.git\n")); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); - git_merge_head_free(their_heads[2]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); + git_annotated_commit_free(their_heads[2]); } void test_merge_workdir_setup__three_remotes(void) @@ -816,31 +816,31 @@ void test_merge_workdir_setup__three_remotes(void) git_oid octo1_oid; git_oid octo2_oid; git_oid octo3_oid; - git_merge_head *our_head, *their_heads[3]; + git_annotated_commit *our_head, *their_heads[3]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID)); - cl_git_pass(git_merge_head_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.first/repo.git", &octo1_oid)); + cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.first/repo.git", &octo1_oid)); cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID)); - cl_git_pass(git_merge_head_from_fetchhead(&their_heads[1], repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH, "http://remote.second/repo.git", &octo2_oid)); + cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[1], repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH, "http://remote.second/repo.git", &octo2_oid)); cl_git_pass(git_oid_fromstr(&octo3_oid, OCTO3_OID)); - cl_git_pass(git_merge_head_from_fetchhead(&their_heads[2], repo, GIT_REFS_HEADS_DIR OCTO3_BRANCH, "http://remote.third/repo.git", &octo3_oid)); + cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[2], repo, GIT_REFS_HEADS_DIR OCTO3_BRANCH, "http://remote.third/repo.git", &octo3_oid)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 3)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 3)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n" OCTO3_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff")); cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branch '" OCTO1_BRANCH "' of http://remote.first/repo.git, branch '" OCTO2_BRANCH "' of http://remote.second/repo.git, branch '" OCTO3_BRANCH "' of http://remote.third/repo.git\n")); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); - git_merge_head_free(their_heads[2]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); + git_annotated_commit_free(their_heads[2]); } void test_merge_workdir_setup__two_remotes(void) @@ -850,35 +850,35 @@ void test_merge_workdir_setup__two_remotes(void) git_oid octo2_oid; git_oid octo3_oid; git_oid octo4_oid; - git_merge_head *our_head, *their_heads[4]; + git_annotated_commit *our_head, *their_heads[4]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_oid_fromstr(&octo1_oid, OCTO1_OID)); - cl_git_pass(git_merge_head_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.first/repo.git", &octo1_oid)); + cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.first/repo.git", &octo1_oid)); cl_git_pass(git_oid_fromstr(&octo2_oid, OCTO2_OID)); - cl_git_pass(git_merge_head_from_fetchhead(&their_heads[1], repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH, "http://remote.second/repo.git", &octo2_oid)); + cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[1], repo, GIT_REFS_HEADS_DIR OCTO2_BRANCH, "http://remote.second/repo.git", &octo2_oid)); cl_git_pass(git_oid_fromstr(&octo3_oid, OCTO3_OID)); - cl_git_pass(git_merge_head_from_fetchhead(&their_heads[2], repo, GIT_REFS_HEADS_DIR OCTO3_BRANCH, "http://remote.first/repo.git", &octo3_oid)); + cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[2], repo, GIT_REFS_HEADS_DIR OCTO3_BRANCH, "http://remote.first/repo.git", &octo3_oid)); cl_git_pass(git_oid_fromstr(&octo4_oid, OCTO4_OID)); - cl_git_pass(git_merge_head_from_fetchhead(&their_heads[3], repo, GIT_REFS_HEADS_DIR OCTO4_BRANCH, "http://remote.second/repo.git", &octo4_oid)); + cl_git_pass(git_annotated_commit_from_fetchhead(&their_heads[3], repo, GIT_REFS_HEADS_DIR OCTO4_BRANCH, "http://remote.second/repo.git", &octo4_oid)); - cl_git_pass(git_merge__setup(repo, our_head, (const git_merge_head **)their_heads, 4)); + cl_git_pass(git_merge__setup(repo, our_head, (const git_annotated_commit **)their_heads, 4)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n" OCTO2_OID "\n" OCTO3_OID "\n" OCTO4_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); cl_assert(test_file_contents(GIT_MERGE_MODE_FILE, "no-ff")); cl_assert(test_file_contents(GIT_MERGE_MSG_FILE, "Merge branches '" OCTO1_BRANCH "' and '" OCTO3_BRANCH "' of http://remote.first/repo.git, branches '" OCTO2_BRANCH "' and '" OCTO4_BRANCH "' of http://remote.second/repo.git\n")); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); - git_merge_head_free(their_heads[1]); - git_merge_head_free(their_heads[2]); - git_merge_head_free(their_heads[3]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); + git_annotated_commit_free(their_heads[1]); + git_annotated_commit_free(their_heads[2]); + git_annotated_commit_free(their_heads[3]); } void test_merge_workdir_setup__id_from_head(void) @@ -886,39 +886,39 @@ void test_merge_workdir_setup__id_from_head(void) git_oid expected_id; const git_oid *id; git_reference *ref; - git_merge_head *heads[3]; + git_annotated_commit *heads[3]; cl_git_pass(git_oid_fromstr(&expected_id, OCTO1_OID)); - cl_git_pass(git_merge_head_from_fetchhead(&heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.url/repo.git", &expected_id)); - id = git_merge_head_id(heads[0]); + cl_git_pass(git_annotated_commit_from_fetchhead(&heads[0], repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH, "http://remote.url/repo.git", &expected_id)); + id = git_annotated_commit_id(heads[0]); cl_assert_equal_i(1, git_oid_equal(id, &expected_id)); - cl_git_pass(git_merge_head_from_id(&heads[1], repo, &expected_id)); - id = git_merge_head_id(heads[1]); + cl_git_pass(git_annotated_commit_lookup(&heads[1], repo, &expected_id)); + id = git_annotated_commit_id(heads[1]); cl_assert_equal_i(1, git_oid_equal(id, &expected_id)); cl_git_pass(git_reference_lookup(&ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&heads[2], repo, ref)); - id = git_merge_head_id(heads[2]); + cl_git_pass(git_annotated_commit_from_ref(&heads[2], repo, ref)); + id = git_annotated_commit_id(heads[2]); cl_assert_equal_i(1, git_oid_equal(id, &expected_id)); git_reference_free(ref); - git_merge_head_free(heads[0]); - git_merge_head_free(heads[1]); - git_merge_head_free(heads[2]); + git_annotated_commit_free(heads[0]); + git_annotated_commit_free(heads[1]); + git_annotated_commit_free(heads[2]); } -struct merge_head_cb_data { +struct annotated_commit_cb_data { const char **oid_str; unsigned int len; unsigned int i; }; -static int merge_head_foreach_cb(const git_oid *oid, void *payload) +static int annotated_commit_foreach_cb(const git_oid *oid, void *payload) { git_oid expected_oid; - struct merge_head_cb_data *cb_data = payload; + struct annotated_commit_cb_data *cb_data = payload; git_oid_fromstr(&expected_oid, cb_data->oid_str[cb_data->i]); cl_assert(git_oid_cmp(&expected_oid, oid) == 0); @@ -931,7 +931,7 @@ void test_merge_workdir_setup__head_notfound(void) int error; cl_git_fail((error = git_repository_mergehead_foreach(repo, - merge_head_foreach_cb, NULL))); + annotated_commit_foreach_cb, NULL))); cl_assert(error == GIT_ENOTFOUND); } @@ -942,7 +942,7 @@ void test_merge_workdir_setup__head_invalid_oid(void) write_file_contents(GIT_MERGE_HEAD_FILE, "invalid-oid\n"); cl_git_fail((error = git_repository_mergehead_foreach(repo, - merge_head_foreach_cb, NULL))); + annotated_commit_foreach_cb, NULL))); cl_assert(error == -1); } @@ -953,7 +953,7 @@ void test_merge_workdir_setup__head_foreach_nonewline(void) write_file_contents(GIT_MERGE_HEAD_FILE, THEIRS_SIMPLE_OID); cl_git_fail((error = git_repository_mergehead_foreach(repo, - merge_head_foreach_cb, NULL))); + annotated_commit_foreach_cb, NULL))); cl_assert(error == -1); } @@ -961,12 +961,12 @@ void test_merge_workdir_setup__head_foreach_one(void) { const char *expected = THEIRS_SIMPLE_OID; - struct merge_head_cb_data cb_data = { &expected, 1 }; + struct annotated_commit_cb_data cb_data = { &expected, 1 }; write_file_contents(GIT_MERGE_HEAD_FILE, THEIRS_SIMPLE_OID "\n"); cl_git_pass(git_repository_mergehead_foreach(repo, - merge_head_foreach_cb, &cb_data)); + annotated_commit_foreach_cb, &cb_data)); cl_assert(cb_data.i == cb_data.len); } @@ -976,7 +976,7 @@ void test_merge_workdir_setup__head_foreach_octopus(void) const char *expected[] = { THEIRS_SIMPLE_OID, OCTO1_OID, OCTO2_OID, OCTO3_OID, OCTO4_OID, OCTO5_OID }; - struct merge_head_cb_data cb_data = { expected, 6 }; + struct annotated_commit_cb_data cb_data = { expected, 6 }; write_file_contents(GIT_MERGE_HEAD_FILE, THEIRS_SIMPLE_OID "\n" @@ -987,7 +987,7 @@ void test_merge_workdir_setup__head_foreach_octopus(void) OCTO5_OID "\n"); cl_git_pass(git_repository_mergehead_foreach(repo, - merge_head_foreach_cb, &cb_data)); + annotated_commit_foreach_cb, &cb_data)); cl_assert(cb_data.i == cb_data.len); } @@ -996,16 +996,16 @@ void test_merge_workdir_setup__retained_after_success(void) { git_oid our_oid; git_reference *octo1_ref; - git_merge_head *our_head, *their_heads[1]; + git_annotated_commit *our_head, *their_heads[1]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref)); - cl_git_pass(git_merge(repo, (const git_merge_head **)&their_heads[0], 1, NULL, NULL)); + cl_git_pass(git_merge(repo, (const git_annotated_commit **)&their_heads[0], 1, NULL, NULL)); cl_assert(test_file_contents(GIT_MERGE_HEAD_FILE, OCTO1_OID "\n")); cl_assert(test_file_contents(GIT_ORIG_HEAD_FILE, ORIG_HEAD "\n")); @@ -1014,27 +1014,27 @@ void test_merge_workdir_setup__retained_after_success(void) git_reference_free(octo1_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); } void test_merge_workdir_setup__removed_after_failure(void) { git_oid our_oid; git_reference *octo1_ref; - git_merge_head *our_head, *their_heads[1]; + git_annotated_commit *our_head, *their_heads[1]; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); - cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); + cl_git_pass(git_annotated_commit_lookup(&our_head, repo, &our_oid)); cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref)); cl_git_rewritefile("merge-resolve/new-in-octo1.txt", "Conflicting file!\n\nMerge will fail!\n"); cl_git_fail(git_merge( - repo, (const git_merge_head **)&their_heads[0], 1, NULL, NULL)); + repo, (const git_annotated_commit **)&their_heads[0], 1, NULL, NULL)); cl_assert(!git_path_exists("merge-resolve/" GIT_MERGE_HEAD_FILE)); cl_assert(!git_path_exists("merge-resolve/" GIT_ORIG_HEAD_FILE)); @@ -1043,6 +1043,6 @@ void test_merge_workdir_setup__removed_after_failure(void) git_reference_free(octo1_ref); - git_merge_head_free(our_head); - git_merge_head_free(their_heads[0]); + git_annotated_commit_free(our_head); + git_annotated_commit_free(their_heads[0]); } diff --git a/tests/merge/workdir/simple.c b/tests/merge/workdir/simple.c index fcd84dcd1..df531f48f 100644 --- a/tests/merge/workdir/simple.c +++ b/tests/merge/workdir/simple.c @@ -95,20 +95,20 @@ void test_merge_workdir_simple__cleanup(void) static void merge_simple_branch(int merge_file_favor, int addl_checkout_strategy) { git_oid their_oids[1]; - git_merge_head *their_heads[1]; + git_annotated_commit *their_heads[1]; git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT; git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT; cl_git_pass(git_oid_fromstr(&their_oids[0], THEIRS_SIMPLE_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[0], repo, &their_oids[0])); + cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &their_oids[0])); merge_opts.file_favor = merge_file_favor; checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_ALLOW_CONFLICTS | addl_checkout_strategy; - cl_git_pass(git_merge(repo, (const git_merge_head **)their_heads, 1, &merge_opts, &checkout_opts)); + cl_git_pass(git_merge(repo, (const git_annotated_commit **)their_heads, 1, &merge_opts, &checkout_opts)); - git_merge_head_free(their_heads[0]); + git_annotated_commit_free(their_heads[0]); } static void set_core_autocrlf_to(git_repository *repo, bool value) @@ -486,7 +486,7 @@ void test_merge_workdir_simple__directory_file(void) { git_reference *head; git_oid their_oids[1], head_commit_id; - git_merge_head *their_heads[1]; + git_annotated_commit *their_heads[1]; git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT; git_commit *head_commit; @@ -519,22 +519,22 @@ void test_merge_workdir_simple__directory_file(void) cl_git_pass(git_reset(repo, (git_object *)head_commit, GIT_RESET_HARD, NULL, NULL, NULL)); cl_git_pass(git_oid_fromstr(&their_oids[0], THEIRS_DIRECTORY_FILE)); - cl_git_pass(git_merge_head_from_id(&their_heads[0], repo, &their_oids[0])); + cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &their_oids[0])); merge_opts.file_favor = 0; - cl_git_pass(git_merge(repo, (const git_merge_head **)their_heads, 1, &merge_opts, NULL)); + cl_git_pass(git_merge(repo, (const git_annotated_commit **)their_heads, 1, &merge_opts, NULL)); cl_assert(merge_test_index(repo_index, merge_index_entries, 20)); git_reference_free(head); git_commit_free(head_commit); - git_merge_head_free(their_heads[0]); + git_annotated_commit_free(their_heads[0]); } void test_merge_workdir_simple__unrelated(void) { git_oid their_oids[1]; - git_merge_head *their_heads[1]; + git_annotated_commit *their_heads[1]; git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT; struct merge_index_entry merge_index_entries[] = { @@ -550,20 +550,20 @@ void test_merge_workdir_simple__unrelated(void) }; cl_git_pass(git_oid_fromstr(&their_oids[0], THEIRS_UNRELATED_PARENT)); - cl_git_pass(git_merge_head_from_id(&their_heads[0], repo, &their_oids[0])); + cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &their_oids[0])); merge_opts.file_favor = 0; - cl_git_pass(git_merge(repo, (const git_merge_head **)their_heads, 1, &merge_opts, NULL)); + cl_git_pass(git_merge(repo, (const git_annotated_commit **)their_heads, 1, &merge_opts, NULL)); cl_assert(merge_test_index(repo_index, merge_index_entries, 9)); - git_merge_head_free(their_heads[0]); + git_annotated_commit_free(their_heads[0]); } void test_merge_workdir_simple__unrelated_with_conflicts(void) { git_oid their_oids[1]; - git_merge_head *their_heads[1]; + git_annotated_commit *their_heads[1]; git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT; struct merge_index_entry merge_index_entries[] = { @@ -581,21 +581,21 @@ void test_merge_workdir_simple__unrelated_with_conflicts(void) }; cl_git_pass(git_oid_fromstr(&their_oids[0], THEIRS_UNRELATED_OID)); - cl_git_pass(git_merge_head_from_id(&their_heads[0], repo, &their_oids[0])); + cl_git_pass(git_annotated_commit_lookup(&their_heads[0], repo, &their_oids[0])); merge_opts.file_favor = 0; - cl_git_pass(git_merge(repo, (const git_merge_head **)their_heads, 1, &merge_opts, NULL)); + cl_git_pass(git_merge(repo, (const git_annotated_commit **)their_heads, 1, &merge_opts, NULL)); cl_assert(merge_test_index(repo_index, merge_index_entries, 11)); - git_merge_head_free(their_heads[0]); + git_annotated_commit_free(their_heads[0]); } void test_merge_workdir_simple__binary(void) { git_oid our_oid, their_oid, our_file_oid; git_commit *our_commit; - git_merge_head *their_head; + git_annotated_commit *their_head; const git_index_entry *binary_entry; struct merge_index_entry merge_index_entries[] = { @@ -610,9 +610,9 @@ void test_merge_workdir_simple__binary(void) cl_git_pass(git_commit_lookup(&our_commit, repo, &our_oid)); cl_git_pass(git_reset(repo, (git_object *)our_commit, GIT_RESET_HARD, NULL, NULL, NULL)); - cl_git_pass(git_merge_head_from_id(&their_head, repo, &their_oid)); + cl_git_pass(git_annotated_commit_lookup(&their_head, repo, &their_oid)); - cl_git_pass(git_merge(repo, (const git_merge_head **)&their_head, 1, NULL, NULL)); + cl_git_pass(git_merge(repo, (const git_annotated_commit **)&their_head, 1, NULL, NULL)); cl_assert(merge_test_index(repo_index, merge_index_entries, 3)); @@ -622,6 +622,6 @@ void test_merge_workdir_simple__binary(void) cl_git_pass(git_oid_fromstr(&our_file_oid, "23ed141a6ae1e798b2f721afedbe947c119111ba")); cl_assert(git_oid_cmp(&binary_entry->id, &our_file_oid) == 0); - git_merge_head_free(their_head); + git_annotated_commit_free(their_head); git_commit_free(our_commit); } diff --git a/tests/merge/workdir/submodules.c b/tests/merge/workdir/submodules.c index eec9f14a9..31ded4662 100644 --- a/tests/merge/workdir/submodules.c +++ b/tests/merge/workdir/submodules.c @@ -30,7 +30,7 @@ void test_merge_workdir_submodules__automerge(void) { git_reference *our_ref, *their_ref; git_commit *our_commit; - git_merge_head *their_head; + git_annotated_commit *their_head; git_index *index; struct merge_index_entry merge_index_entries[] = { @@ -47,15 +47,15 @@ void test_merge_workdir_submodules__automerge(void) cl_git_pass(git_reset(repo, (git_object *)our_commit, GIT_RESET_HARD, NULL, NULL, NULL)); cl_git_pass(git_reference_lookup(&their_ref, repo, "refs/heads/" SUBMODULE_OTHER_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_head, repo, their_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_head, repo, their_ref)); - cl_git_pass(git_merge(repo, (const git_merge_head **)&their_head, 1, NULL, NULL)); + cl_git_pass(git_merge(repo, (const git_annotated_commit **)&their_head, 1, NULL, NULL)); cl_git_pass(git_repository_index(&index, repo)); cl_assert(merge_test_index(index, merge_index_entries, 6)); git_index_free(index); - git_merge_head_free(their_head); + git_annotated_commit_free(their_head); git_commit_free(our_commit); git_reference_free(their_ref); git_reference_free(our_ref); @@ -65,7 +65,7 @@ void test_merge_workdir_submodules__take_changed(void) { git_reference *our_ref, *their_ref; git_commit *our_commit; - git_merge_head *their_head; + git_annotated_commit *their_head; git_index *index; struct merge_index_entry merge_index_entries[] = { @@ -80,15 +80,15 @@ void test_merge_workdir_submodules__take_changed(void) cl_git_pass(git_reset(repo, (git_object *)our_commit, GIT_RESET_HARD, NULL, NULL, NULL)); cl_git_pass(git_reference_lookup(&their_ref, repo, "refs/heads/" SUBMODULE_OTHER2_BRANCH)); - cl_git_pass(git_merge_head_from_ref(&their_head, repo, their_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_head, repo, their_ref)); - cl_git_pass(git_merge(repo, (const git_merge_head **)&their_head, 1, NULL, NULL)); + cl_git_pass(git_merge(repo, (const git_annotated_commit **)&their_head, 1, NULL, NULL)); cl_git_pass(git_repository_index(&index, repo)); cl_assert(merge_test_index(index, merge_index_entries, 4)); git_index_free(index); - git_merge_head_free(their_head); + git_annotated_commit_free(their_head); git_commit_free(our_commit); git_reference_free(their_ref); git_reference_free(our_ref); diff --git a/tests/merge/workdir/trivial.c b/tests/merge/workdir/trivial.c index cc82d990c..fa261c3a1 100644 --- a/tests/merge/workdir/trivial.c +++ b/tests/merge/workdir/trivial.c @@ -33,7 +33,7 @@ static int merge_trivial(const char *ours, const char *theirs) git_buf branch_buf = GIT_BUF_INIT; git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT; git_reference *our_ref, *their_ref; - git_merge_head *their_heads[1]; + git_annotated_commit *their_heads[1]; checkout_opts.checkout_strategy = GIT_CHECKOUT_FORCE; @@ -45,14 +45,14 @@ static int merge_trivial(const char *ours, const char *theirs) git_buf_clear(&branch_buf); git_buf_printf(&branch_buf, "%s%s", GIT_REFS_HEADS_DIR, theirs); cl_git_pass(git_reference_lookup(&their_ref, repo, branch_buf.ptr)); - cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, their_ref)); + cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, their_ref)); - cl_git_pass(git_merge(repo, (const git_merge_head **)their_heads, 1, NULL, NULL)); + cl_git_pass(git_merge(repo, (const git_annotated_commit **)their_heads, 1, NULL, NULL)); git_buf_free(&branch_buf); git_reference_free(our_ref); git_reference_free(their_ref); - git_merge_head_free(their_heads[0]); + git_annotated_commit_free(their_heads[0]); return 0; } |