Commit 0d6caa2d authored by Duy Nguyen's avatar Duy Nguyen Committed by Junio C Hamano

merge-recursive.c: remove implicit dependency on the_index

Signed-off-by: Duy Nguyen's avatarNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 3a7a698e
......@@ -1545,7 +1545,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
* changes.
*/
init_merge_options(&o);
init_merge_options(&o, the_repository);
o.branch1 = "HEAD";
their_tree_name = xstrfmt("%.*s", linelen(state->msg), state->msg);
......
......@@ -670,7 +670,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
* a pain; plumb in an option to set
* o.renormalize?
*/
init_merge_options(&o);
init_merge_options(&o, the_repository);
o.verbosity = 0;
work = write_tree_from_memory(&o);
......
......@@ -28,7 +28,7 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
struct merge_options o;
struct commit *result;
init_merge_options(&o);
init_merge_options(&o, the_repository);
if (argv[0] && ends_with(argv[0], "-subtree"))
o.subtree_shift = "";
......
......@@ -702,7 +702,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
return 2;
}
init_merge_options(&o);
init_merge_options(&o, the_repository);
if (!strcmp(strategy, "subtree"))
o.subtree_shift = "";
......
This diff is collapsed.
......@@ -6,6 +6,8 @@
struct commit;
struct repository;
struct merge_options {
const char *ancestor;
const char *branch1;
......@@ -34,6 +36,7 @@ struct merge_options {
struct string_list df_conflict_file_set;
struct unpack_trees_options unpack_opts;
struct index_state orig_index;
struct repository *repo;
};
/*
......@@ -92,7 +95,8 @@ int merge_recursive_generic(struct merge_options *o,
const struct object_id **ca,
struct commit **result);
void init_merge_options(struct merge_options *o);
void init_merge_options(struct merge_options *o,
struct repository *repo);
struct tree *write_tree_from_memory(struct merge_options *o);
int parse_merge_opt(struct merge_options *out, const char *s);
......
......@@ -545,7 +545,7 @@ static int do_recursive_merge(struct repository *r,
repo_read_index(r);
init_merge_options(&o);
init_merge_options(&o, r);
o.ancestor = base ? base_label : "(empty tree)";
o.branch1 = "HEAD";
o.branch2 = next ? next_label : "(empty tree)";
......@@ -3300,7 +3300,7 @@ static int do_merge(struct repository *r,
free_commit_list(bases);
repo_read_index(r);
init_merge_options(&o);
init_merge_options(&o, r);
o.branch1 = "HEAD";
o.branch2 = ref_name.buf;
o.buffer_output = 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment