Subject: [PATCH v3 3/3] merge: pass aggressive when rename detection is turned off

From: Ben Peart <[email-masked]>
Date: Thu, 26 Apr 2018 20:52:22 +0000

Set aggressive flag in git_merge_trees() when rename detection is turned off.
This allows read_tree() to auto resolve more cases that would have otherwise
been handled by the rename detection.

Reviewed-by: Johannes Schindelin <[email-masked]>
Signed-off-by: Ben Peart <[email-masked]>
---
 merge-recursive.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/merge-recursive.c b/merge-recursive.c
index 2637d34d87..6cc4404144 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -276,6 +276,7 @@ static void init_tree_desc_from_tree(struct tree_desc *desc, struct tree *tree)
 }
 
 static int git_merge_trees(int index_only,
+			   int aggressive,
 			   struct tree *common,
 			   struct tree *head,
 			   struct tree *merge)
@@ -294,6 +295,7 @@ static int git_merge_trees(int index_only,
 	opts.fn = threeway_merge;
 	opts.src_index = &the_index;
 	opts.dst_index = &the_index;
+	opts.aggressive = aggressive;
 	setup_unpack_trees_porcelain(&opts, "merge");
 
 	init_tree_desc_from_tree(t+0, common);
@@ -1993,7 +1995,7 @@ int merge_trees(struct merge_options *o,
 		return 1;
 	}
 
-	code = git_merge_trees(o->call_depth, common, head, merge);
+	code = git_merge_trees(o->call_depth, !merge_detect_rename(o), common, head, merge);
 
 	if (code != 0) {
 		if (show(o, 4) || o->call_depth)
-- 
2.17.0.windows.1