diff options
author | Edward Thomson <ethomson@microsoft.com> | 2014-03-11 18:40:38 -0700 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2014-03-20 09:25:07 -0700 |
commit | 02105a27f01509ce4e641487cae040662ee477a2 (patch) | |
tree | c39db31754e115473ebbe92a9f35bf5703d714c6 | |
parent | 1c0b6a38bacb54de300d936338d4adb04a9b311f (diff) | |
download | libgit2-02105a27f01509ce4e641487cae040662ee477a2.tar.gz |
Change signature of `git_merge` to take merge and checkout opts
-rw-r--r-- | include/git2/merge.h | 32 | ||||
-rw-r--r-- | src/merge.c | 64 | ||||
-rw-r--r-- | tests/merge/merge_helpers.c | 6 | ||||
-rw-r--r-- | tests/merge/merge_helpers.h | 3 | ||||
-rw-r--r-- | tests/merge/workdir/dirty.c | 9 | ||||
-rw-r--r-- | tests/merge/workdir/renames.c | 27 | ||||
-rw-r--r-- | tests/merge/workdir/setup.c | 6 | ||||
-rw-r--r-- | tests/merge/workdir/simple.c | 30 | ||||
-rw-r--r-- | tests/merge/workdir/submodules.c | 6 | ||||
-rw-r--r-- | tests/merge/workdir/trivial.c | 3 | ||||
-rw-r--r-- | tests/structinit/structinit.c | 5 |
11 files changed, 75 insertions, 116 deletions
diff --git a/include/git2/merge.h b/include/git2/merge.h index e20025b7a..15bed2a2a 100644 --- a/include/git2/merge.h +++ b/include/git2/merge.h @@ -274,32 +274,6 @@ GIT_EXTERN(int) git_merge_status( const git_merge_head **their_heads, size_t their_heads_len); -typedef struct { - unsigned int version; - - /** Options for handling the merges of individual files. */ - git_merge_tree_opts merge_tree_opts; - - /** Options for writing the merge result to the working directory. */ - git_checkout_options checkout_opts; -} git_merge_opts; - -#define GIT_MERGE_OPTS_VERSION 1 -#define GIT_MERGE_OPTS_INIT {GIT_MERGE_OPTS_VERSION, GIT_MERGE_TREE_OPTS_INIT, GIT_CHECKOUT_OPTIONS_INIT} - -/** - * Initializes a `git_merge_opts` with default values. Equivalent to creating - * an instance with GIT_MERGE_OPTS_INIT. - * - * @param opts the `git_merge_opts` instance to initialize. - * @param version the version of the struct; you should pass - * `GIT_MERGE_OPTS_VERSION` here. - * @return Zero on success; -1 on failure. - */ -GIT_EXTERN(int) git_merge_init_opts( - git_merge_opts* opts, - int version); - /** * Find a merge base between two commits * @@ -522,7 +496,8 @@ GIT_EXTERN(int) git_merge_commits( * @param repo the repository to merge * @param merge_heads the heads to merge into * @param merge_heads_len the number of heads to merge - * @param opts merge options + * @param checkout_opts merge options + * @param checkout_opts checkout options * @return 0 on success or error code */ GIT_EXTERN(int) git_merge( @@ -530,7 +505,8 @@ GIT_EXTERN(int) git_merge( git_repository *repo, const git_merge_head **their_heads, size_t their_heads_len, - const git_merge_opts *opts); + const git_merge_tree_opts *merge_opts, + const git_checkout_options *checkout_opts); /** * Returns true if a merge is "up-to-date", meaning that the commit(s) diff --git a/src/merge.c b/src/merge.c index b7f043aca..12e4a3b64 100644 --- a/src/merge.c +++ b/src/merge.c @@ -2168,10 +2168,10 @@ const char *merge_their_label(const char *branchname) return slash+1; } -static int merge_normalize_opts( +static int merge_normalize_checkout_opts( git_repository *repo, - git_merge_opts *opts, - const git_merge_opts *given, + git_checkout_options *checkout_opts, + const git_checkout_options *given_checkout_opts, const git_merge_head *ancestor_head, const git_merge_head *our_head, size_t their_heads_len, @@ -2183,38 +2183,38 @@ static int merge_normalize_opts( GIT_UNUSED(repo); - if (given != NULL) - memcpy(opts, given, sizeof(git_merge_opts)); + if (given_checkout_opts != NULL) + memcpy(checkout_opts, given_checkout_opts, sizeof(git_checkout_options)); else { - git_merge_opts default_opts = GIT_MERGE_OPTS_INIT; - memcpy(opts, &default_opts, sizeof(git_merge_opts)); + git_checkout_options default_checkout_opts = GIT_CHECKOUT_OPTIONS_INIT; + memcpy(checkout_opts, &default_checkout_opts, sizeof(git_checkout_options)); } - if (!opts->checkout_opts.checkout_strategy) - opts->checkout_opts.checkout_strategy = default_checkout_strategy; + if (!checkout_opts->checkout_strategy) + checkout_opts->checkout_strategy = default_checkout_strategy; /* TODO: for multiple ancestors in merge-recursive, this is "merged common ancestors" */ - if (!opts->checkout_opts.ancestor_label) { + if (!checkout_opts->ancestor_label) { if (ancestor_head && ancestor_head->commit) - opts->checkout_opts.ancestor_label = git_commit_summary(ancestor_head->commit); + checkout_opts->ancestor_label = git_commit_summary(ancestor_head->commit); else - opts->checkout_opts.ancestor_label = "ancestor"; + checkout_opts->ancestor_label = "ancestor"; } - if (!opts->checkout_opts.our_label) { + if (!checkout_opts->our_label) { if (our_head && our_head->ref_name) - opts->checkout_opts.our_label = our_head->ref_name; + checkout_opts->our_label = our_head->ref_name; else - opts->checkout_opts.our_label = "ours"; + checkout_opts->our_label = "ours"; } - if (!opts->checkout_opts.their_label) { + if (!checkout_opts->their_label) { if (their_heads_len == 1 && their_heads[0]->ref_name) - opts->checkout_opts.their_label = merge_their_label(their_heads[0]->ref_name); + checkout_opts->their_label = merge_their_label(their_heads[0]->ref_name); else if (their_heads_len == 1) - opts->checkout_opts.their_label = their_heads[0]->oid_str; + checkout_opts->their_label = their_heads[0]->oid_str; else - opts->checkout_opts.their_label = "theirs"; + checkout_opts->their_label = "theirs"; } return error; @@ -2552,11 +2552,12 @@ int git_merge( git_repository *repo, const git_merge_head **their_heads, size_t their_heads_len, - const git_merge_opts *given_opts) + const git_merge_tree_opts *merge_opts, + const git_checkout_options *given_checkout_opts) { git_merge_result *result; - git_merge_opts opts; git_reference *our_ref = NULL; + git_checkout_options checkout_opts; git_merge_head *ancestor_head = NULL, *our_head = NULL; git_tree *ancestor_tree = NULL, *our_tree = NULL, **their_trees = NULL; git_index *index_new = NULL, *index_repo = NULL; @@ -2567,8 +2568,6 @@ int git_merge( *out = NULL; - GITERR_CHECK_VERSION(given_opts, GIT_MERGE_OPTS_VERSION, "git_merge_opts"); - if (their_heads_len != 1) { giterr_set(GITERR_MERGE, "Can only merge a single branch"); return -1; @@ -2583,7 +2582,8 @@ int git_merge( if ((error = merge_heads(&ancestor_head, &our_head, repo, their_heads, their_heads_len)) < 0) goto on_error; - if ((error = merge_normalize_opts(repo, &opts, given_opts, ancestor_head, our_head, their_heads_len, their_heads)) < 0) + if ((error = merge_normalize_checkout_opts(repo, &checkout_opts, given_checkout_opts, + ancestor_head, our_head, their_heads_len, their_heads)) < 0) goto on_error; /* Write the merge files to the repository. */ @@ -2604,10 +2604,10 @@ int git_merge( /* TODO: recursive, octopus, etc... */ - if ((error = git_merge_trees(&index_new, repo, ancestor_tree, our_tree, their_trees[0], &opts.merge_tree_opts)) < 0 || + if ((error = git_merge_trees(&index_new, repo, ancestor_tree, our_tree, their_trees[0], merge_opts)) < 0 || (error = git_merge__indexes(repo, index_new)) < 0 || (error = git_repository_index(&index_repo, repo)) < 0 || - (error = git_checkout_index(repo, index_repo, &opts.checkout_opts)) < 0) + (error = git_checkout_index(repo, index_repo, &checkout_opts)) < 0) goto on_error; result->index = index_new; @@ -2779,18 +2779,6 @@ void git_merge_head_free(git_merge_head *head) git__free(head); } -int git_merge_init_opts(git_merge_opts* opts, int version) -{ - if (version != GIT_MERGE_OPTS_VERSION) { - giterr_set(GITERR_INVALID, "Invalid version %d for git_merge_opts", version); - return -1; - } else { - git_merge_opts o = GIT_MERGE_OPTS_INIT; - memcpy(opts, &o, sizeof(o)); - return 0; - } -} - int git_merge_tree_init_opts(git_merge_tree_opts* opts, int version) { if (version != GIT_MERGE_TREE_OPTS_VERSION) { diff --git a/tests/merge/merge_helpers.c b/tests/merge/merge_helpers.c index 14a30b288..e3c2b9e4a 100644 --- a/tests/merge/merge_helpers.c +++ b/tests/merge/merge_helpers.c @@ -79,7 +79,9 @@ int merge_commits_from_branches( return 0; } -int merge_branches(git_merge_result **result, git_repository *repo, const char *ours_branch, const char *theirs_branch, git_merge_opts *opts) +int merge_branches(git_merge_result **result, git_repository *repo, + const char *ours_branch, const char *theirs_branch, + git_merge_tree_opts *merge_opts, git_checkout_options *checkout_opts) { git_reference *head_ref, *theirs_ref; git_merge_head *theirs_head; @@ -93,7 +95,7 @@ int merge_branches(git_merge_result **result, git_repository *repo, const char * 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_merge(result, repo, (const git_merge_head **)&theirs_head, 1, opts)); + cl_git_pass(git_merge(result, repo, (const git_merge_head **)&theirs_head, 1, merge_opts, checkout_opts)); git_reference_free(head_ref); git_reference_free(theirs_ref); diff --git a/tests/merge/merge_helpers.h b/tests/merge/merge_helpers.h index 63d1cb7a9..e5dc34b06 100644 --- a/tests/merge/merge_helpers.h +++ b/tests/merge/merge_helpers.h @@ -93,7 +93,8 @@ int merge_commits_from_branches( git_merge_tree_opts *opts); int merge_branches(git_merge_result **result, git_repository *repo, - const char *ours_branch, const char *theirs_branch, git_merge_opts *opts); + const char *ours_branch, const char *theirs_branch, + git_merge_tree_opts *merge_opts, git_checkout_options *checkout_opts); int merge_test_diff_list(git_merge_diff_list *diff_list, const struct merge_index_entry expected[], size_t expected_len); diff --git a/tests/merge/workdir/dirty.c b/tests/merge/workdir/dirty.c index a77f9b205..61b83a648 100644 --- a/tests/merge/workdir/dirty.c +++ b/tests/merge/workdir/dirty.c @@ -90,15 +90,16 @@ static int merge_branch(git_merge_result **result, int merge_file_favor, int che { git_oid their_oids[1]; git_merge_head *their_heads[1]; - git_merge_opts opts = GIT_MERGE_OPTS_INIT; + git_merge_tree_opts merge_opts = GIT_MERGE_TREE_OPTS_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])); - opts.merge_tree_opts.file_favor = merge_file_favor; - opts.checkout_opts.checkout_strategy = checkout_strategy; - error = git_merge(result, repo, (const git_merge_head **)their_heads, 1, &opts); + merge_opts.file_favor = merge_file_favor; + checkout_opts.checkout_strategy = checkout_strategy; + error = git_merge(result, repo, (const git_merge_head **)their_heads, 1, &merge_opts, &checkout_opts); git_merge_head_free(their_heads[0]); diff --git a/tests/merge/workdir/renames.c b/tests/merge/workdir/renames.c index 27747720e..14308efe0 100644 --- a/tests/merge/workdir/renames.c +++ b/tests/merge/workdir/renames.c @@ -35,7 +35,7 @@ void test_merge_workdir_renames__cleanup(void) void test_merge_workdir_renames__renames(void) { git_merge_result *result; - git_merge_opts opts = GIT_MERGE_OPTS_INIT; + git_merge_tree_opts merge_opts = GIT_MERGE_TREE_OPTS_INIT; struct merge_index_entry merge_index_entries[] = { { 0100644, "68c6c84b091926c7d90aa6a79b2bc3bb6adccd8e", 0, "0a-no-change.txt" }, @@ -64,10 +64,10 @@ void test_merge_workdir_renames__renames(void) { 0100644, "b69fe837e4cecfd4c9a40cdca7c138468687df07", 0, "7-both-renamed.txt~rename_conflict_theirs" }, }; - opts.merge_tree_opts.flags |= GIT_MERGE_TREE_FIND_RENAMES; - opts.merge_tree_opts.rename_threshold = 50; + merge_opts.flags |= GIT_MERGE_TREE_FIND_RENAMES; + merge_opts.rename_threshold = 50; - cl_git_pass(merge_branches(&result, repo, GIT_REFS_HEADS_DIR BRANCH_RENAME_OURS, GIT_REFS_HEADS_DIR BRANCH_RENAME_THEIRS, &opts)); + cl_git_pass(merge_branches(&result, repo, GIT_REFS_HEADS_DIR BRANCH_RENAME_OURS, GIT_REFS_HEADS_DIR BRANCH_RENAME_THEIRS, &merge_opts, NULL)); cl_assert(merge_test_workdir(repo, merge_index_entries, 24)); git_merge_result_free(result); @@ -77,7 +77,8 @@ void test_merge_workdir_renames__ours(void) { git_index *index; git_merge_result *result; - git_merge_opts opts = GIT_MERGE_OPTS_INIT; + git_merge_tree_opts merge_opts = GIT_MERGE_TREE_OPTS_INIT; + git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT; struct merge_index_entry merge_index_entries[] = { { 0100644, "68c6c84b091926c7d90aa6a79b2bc3bb6adccd8e", 0, "0a-no-change.txt" }, @@ -102,11 +103,11 @@ void test_merge_workdir_renames__ours(void) { 0100644, "b42712cfe99a1a500b2a51fe984e0b8a7702ba11", 0, "7-both-renamed.txt" }, }; - opts.merge_tree_opts.flags |= GIT_MERGE_TREE_FIND_RENAMES; - opts.merge_tree_opts.rename_threshold = 50; - opts.checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_USE_OURS; + merge_opts.flags |= GIT_MERGE_TREE_FIND_RENAMES; + merge_opts.rename_threshold = 50; + checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE | GIT_CHECKOUT_USE_OURS; - cl_git_pass(merge_branches(&result, repo, GIT_REFS_HEADS_DIR BRANCH_RENAME_OURS, GIT_REFS_HEADS_DIR BRANCH_RENAME_THEIRS, &opts)); + cl_git_pass(merge_branches(&result, repo, GIT_REFS_HEADS_DIR BRANCH_RENAME_OURS, GIT_REFS_HEADS_DIR BRANCH_RENAME_THEIRS, &merge_opts, &checkout_opts)); cl_git_pass(git_repository_index(&index, repo)); cl_git_pass(git_index_write(index)); cl_assert(merge_test_workdir(repo, merge_index_entries, 20)); @@ -118,7 +119,7 @@ void test_merge_workdir_renames__ours(void) void test_merge_workdir_renames__similar(void) { git_merge_result *result; - git_merge_opts opts = GIT_MERGE_OPTS_INIT; + git_merge_tree_opts merge_opts = GIT_MERGE_TREE_OPTS_INIT; /* * Note: this differs slightly from the core git merge result - there, 4a is @@ -152,10 +153,10 @@ void test_merge_workdir_renames__similar(void) { 0100644, "b69fe837e4cecfd4c9a40cdca7c138468687df07", 0, "7-both-renamed.txt~rename_conflict_theirs" }, }; - opts.merge_tree_opts.flags |= GIT_MERGE_TREE_FIND_RENAMES; - opts.merge_tree_opts.rename_threshold = 50; + merge_opts.flags |= GIT_MERGE_TREE_FIND_RENAMES; + merge_opts.rename_threshold = 50; - cl_git_pass(merge_branches(&result, repo, GIT_REFS_HEADS_DIR BRANCH_RENAME_OURS, GIT_REFS_HEADS_DIR BRANCH_RENAME_THEIRS, &opts)); + cl_git_pass(merge_branches(&result, repo, GIT_REFS_HEADS_DIR BRANCH_RENAME_OURS, GIT_REFS_HEADS_DIR BRANCH_RENAME_THEIRS, &merge_opts, NULL)); cl_assert(merge_test_workdir(repo, merge_index_entries, 24)); git_merge_result_free(result); diff --git a/tests/merge/workdir/setup.c b/tests/merge/workdir/setup.c index d23e4547a..708599555 100644 --- a/tests/merge/workdir/setup.c +++ b/tests/merge/workdir/setup.c @@ -970,7 +970,6 @@ 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_merge_opts opts = GIT_MERGE_OPTS_INIT; git_merge_result *result; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); @@ -980,7 +979,7 @@ void test_merge_workdir_setup__retained_after_success(void) cl_git_pass(git_merge_head_from_ref(&their_heads[0], repo, octo1_ref)); - cl_git_pass(git_merge(&result, repo, (const git_merge_head **)&their_heads[0], 1, &opts)); + cl_git_pass(git_merge(&result, repo, (const git_merge_head **)&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")); @@ -1000,7 +999,6 @@ void test_merge_workdir_setup__removed_after_failure(void) git_reference *octo1_ref; git_merge_head *our_head, *their_heads[1]; git_merge_result *result; - git_merge_opts opts = GIT_MERGE_OPTS_INIT; cl_git_pass(git_oid_fromstr(&our_oid, ORIG_HEAD)); cl_git_pass(git_merge_head_from_id(&our_head, repo, &our_oid)); @@ -1012,7 +1010,7 @@ void test_merge_workdir_setup__removed_after_failure(void) "Conflicting file!\n\nMerge will fail!\n"); cl_git_fail(git_merge( - &result, repo, (const git_merge_head **)&their_heads[0], 1, &opts)); + &result, repo, (const git_merge_head **)&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)); diff --git a/tests/merge/workdir/simple.c b/tests/merge/workdir/simple.c index 07c60c5fa..e60b2db18 100644 --- a/tests/merge/workdir/simple.c +++ b/tests/merge/workdir/simple.c @@ -97,14 +97,15 @@ static git_merge_result *merge_simple_branch(int merge_file_favor, int checkout_ git_oid their_oids[1]; git_merge_head *their_heads[1]; git_merge_result *result; - git_merge_opts opts = GIT_MERGE_OPTS_INIT; + git_merge_tree_opts merge_opts = GIT_MERGE_TREE_OPTS_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])); - opts.merge_tree_opts.file_favor = merge_file_favor; - opts.checkout_opts.checkout_strategy = checkout_strategy; - cl_git_pass(git_merge(&result, repo, (const git_merge_head **)their_heads, 1, &opts)); + merge_opts.file_favor = merge_file_favor; + checkout_opts.checkout_strategy = checkout_strategy; + cl_git_pass(git_merge(&result, repo, (const git_merge_head **)their_heads, 1, &merge_opts, &checkout_opts)); git_merge_head_free(their_heads[0]); @@ -522,7 +523,7 @@ void test_merge_workdir_simple__directory_file(void) git_oid their_oids[1], head_commit_id; git_merge_head *their_heads[1]; git_merge_result *result; - git_merge_opts opts = GIT_MERGE_OPTS_INIT; + git_merge_tree_opts merge_opts = GIT_MERGE_TREE_OPTS_INIT; git_commit *head_commit; struct merge_index_entry merge_index_entries[] = { @@ -556,8 +557,8 @@ void test_merge_workdir_simple__directory_file(void) 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])); - opts.merge_tree_opts.file_favor = 0; - cl_git_pass(git_merge(&result, repo, (const git_merge_head **)their_heads, 1, &opts)); + merge_opts.file_favor = 0; + cl_git_pass(git_merge(&result, repo, (const git_merge_head **)their_heads, 1, &merge_opts, NULL)); cl_assert(merge_test_index(repo_index, merge_index_entries, 20)); @@ -572,7 +573,7 @@ void test_merge_workdir_simple__unrelated(void) git_oid their_oids[1]; git_merge_head *their_heads[1]; git_merge_result *result; - git_merge_opts opts = GIT_MERGE_OPTS_INIT; + git_merge_tree_opts merge_opts = GIT_MERGE_TREE_OPTS_INIT; struct merge_index_entry merge_index_entries[] = { { 0100644, "233c0919c998ed110a4b6ff36f353aec8b713487", 0, "added-in-master.txt" }, @@ -589,8 +590,8 @@ 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])); - opts.merge_tree_opts.file_favor = 0; - cl_git_pass(git_merge(&result, repo, (const git_merge_head **)their_heads, 1, &opts)); + merge_opts.file_favor = 0; + cl_git_pass(git_merge(&result, repo, (const git_merge_head **)their_heads, 1, &merge_opts, NULL)); cl_assert(merge_test_index(repo_index, merge_index_entries, 9)); @@ -603,7 +604,7 @@ void test_merge_workdir_simple__unrelated_with_conflicts(void) git_oid their_oids[1]; git_merge_head *their_heads[1]; git_merge_result *result; - git_merge_opts opts = GIT_MERGE_OPTS_INIT; + git_merge_tree_opts merge_opts = GIT_MERGE_TREE_OPTS_INIT; struct merge_index_entry merge_index_entries[] = { { 0100644, "233c0919c998ed110a4b6ff36f353aec8b713487", 0, "added-in-master.txt" }, @@ -622,8 +623,8 @@ 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])); - opts.merge_tree_opts.file_favor = 0; - cl_git_pass(git_merge(&result, repo, (const git_merge_head **)their_heads, 1, &opts)); + merge_opts.file_favor = 0; + cl_git_pass(git_merge(&result, repo, (const git_merge_head **)their_heads, 1, &merge_opts, NULL)); cl_assert(merge_test_index(repo_index, merge_index_entries, 11)); @@ -638,7 +639,6 @@ void test_merge_workdir_simple__binary(void) git_merge_head *their_head; git_merge_result *result; const git_index_entry *binary_entry; - git_merge_opts opts = GIT_MERGE_OPTS_INIT; struct merge_index_entry merge_index_entries[] = { { 0100644, "1c51d885170f57a0c4e8c69ff6363d91a5b51f85", 1, "binary" }, @@ -654,7 +654,7 @@ void test_merge_workdir_simple__binary(void) cl_git_pass(git_merge_head_from_id(&their_head, repo, &their_oid)); - cl_git_pass(git_merge(&result, repo, (const git_merge_head **)&their_head, 1, &opts)); + cl_git_pass(git_merge(&result, repo, (const git_merge_head **)&their_head, 1, NULL, NULL)); cl_assert(merge_test_index(repo_index, merge_index_entries, 3)); diff --git a/tests/merge/workdir/submodules.c b/tests/merge/workdir/submodules.c index 42451bde7..296f30de5 100644 --- a/tests/merge/workdir/submodules.c +++ b/tests/merge/workdir/submodules.c @@ -32,7 +32,6 @@ void test_merge_workdir_submodules__automerge(void) git_commit *our_commit; git_merge_head *their_head; git_merge_result *result; - git_merge_opts opts = GIT_MERGE_OPTS_INIT; git_index *index; struct merge_index_entry merge_index_entries[] = { @@ -51,7 +50,7 @@ void test_merge_workdir_submodules__automerge(void) 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_merge(&result, repo, (const git_merge_head **)&their_head, 1, &opts)); + cl_git_pass(git_merge(&result, repo, (const git_merge_head **)&their_head, 1, NULL, NULL)); cl_git_pass(git_repository_index(&index, repo)); cl_assert(merge_test_index(index, merge_index_entries, 6)); @@ -70,7 +69,6 @@ void test_merge_workdir_submodules__take_changed(void) git_commit *our_commit; git_merge_head *their_head; git_merge_result *result; - git_merge_opts opts = GIT_MERGE_OPTS_INIT; git_index *index; struct merge_index_entry merge_index_entries[] = { @@ -87,7 +85,7 @@ void test_merge_workdir_submodules__take_changed(void) 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_merge(&result, repo, (const git_merge_head **)&their_head, 1, &opts)); + cl_git_pass(git_merge(&result, repo, (const git_merge_head **)&their_head, 1, NULL, NULL)); cl_git_pass(git_repository_index(&index, repo)); cl_assert(merge_test_index(index, merge_index_entries, 4)); diff --git a/tests/merge/workdir/trivial.c b/tests/merge/workdir/trivial.c index 8b0d32894..ffbb56cab 100644 --- a/tests/merge/workdir/trivial.c +++ b/tests/merge/workdir/trivial.c @@ -34,7 +34,6 @@ static int merge_trivial(const char *ours, const char *theirs) git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT; git_reference *our_ref, *their_ref; git_merge_head *their_heads[1]; - git_merge_opts opts = GIT_MERGE_OPTS_INIT; git_merge_result *result; checkout_opts.checkout_strategy = GIT_CHECKOUT_FORCE; @@ -49,7 +48,7 @@ static int merge_trivial(const char *ours, const char *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_merge(&result, repo, (const git_merge_head **)their_heads, 1, &opts)); + cl_git_pass(git_merge(&result, repo, (const git_merge_head **)their_heads, 1, NULL, NULL)); git_buf_free(&branch_buf); git_reference_free(our_ref); diff --git a/tests/structinit/structinit.c b/tests/structinit/structinit.c index 61fe8c786..fc44898cc 100644 --- a/tests/structinit/structinit.c +++ b/tests/structinit/structinit.c @@ -80,11 +80,6 @@ void test_structinit_structinit__compare(void) git_merge_tree_opts, GIT_MERGE_TREE_OPTS_VERSION, \ GIT_MERGE_TREE_OPTS_INIT, git_merge_tree_init_opts); - /* merge */ - CHECK_MACRO_FUNC_INIT_EQUAL( \ - git_merge_opts, GIT_MERGE_OPTS_VERSION, \ - GIT_MERGE_OPTS_INIT, git_merge_init_opts); - /* push */ CHECK_MACRO_FUNC_INIT_EQUAL( \ git_push_options, GIT_PUSH_OPTIONS_VERSION, \ |