aboutsummaryrefslogtreecommitdiff
path: root/builtin-checkout.c
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2008-08-25 16:25:57 +0200
committerJunio C Hamano <gitster@pobox.com>2008-08-30 20:46:54 -0700
commit8a2fce1895c058945d8e2dbd8cb7456cc7450ad8 (patch)
tree5a5b8822510adea8f39b4f9262b58f8a70f35008 /builtin-checkout.c
parent73118f89b81f5a3ed1bb56e2517627d56e9ebdfb (diff)
downloadgit-8a2fce1895c058945d8e2dbd8cb7456cc7450ad8.tar.gz
git-8a2fce1895c058945d8e2dbd8cb7456cc7450ad8.tar.xz
merge-recursive: introduce merge_options
This makes it possible to avoid passing the labels of branches as arguments to merge_recursive(), merge_trees() and merge_recursive_generic(). It also takes care of subtree merge, output buffering, verbosity, and rename limits - these were global variables till now in merge-recursive.c. A new function, named init_merge_options(), is introduced as well, it clears the struct merge_info, then initializes with default values, finally updates the default values based on the config and environment variables. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-checkout.c')
-rw-r--r--builtin-checkout.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/builtin-checkout.c b/builtin-checkout.c
index b380ad6e8..f3c6b0fad 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -264,6 +264,7 @@ static int merge_working_tree(struct checkout_opts *opts,
*/
struct tree *result;
struct tree *work;
+ struct merge_options o;
if (!opts->merge)
return 1;
parse_commit(old->commit);
@@ -282,13 +283,17 @@ static int merge_working_tree(struct checkout_opts *opts,
*/
add_files_to_cache(NULL, NULL, 0);
- work = write_tree_from_memory();
+ init_merge_options(&o);
+ o.verbosity = 0;
+ work = write_tree_from_memory(&o);
ret = reset_tree(new->commit->tree, opts, 1);
if (ret)
return ret;
- merge_trees(new->commit->tree, work, old->commit->tree,
- new->name, "local", &result);
+ o.branch1 = new->name;
+ o.branch2 = "local";
+ merge_trees(&o, new->commit->tree, work,
+ old->commit->tree, &result);
ret = reset_tree(new->commit->tree, opts, 0);
if (ret)
return ret;