]> granicus.if.org Git - git/commitdiff
merge-recursive: add ability to turn off directory rename detection
authorElijah Newren <newren@gmail.com>
Wed, 29 Aug 2018 07:06:12 +0000 (00:06 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Aug 2018 14:58:59 +0000 (07:58 -0700)
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-recursive.c
merge-recursive.h

index f110e1c5ecbd6254b25785ecb49f29cb7bb75ed2..bf3cb03d3a4ec16a4a0c231fbc2715af029e013a 100644 (file)
@@ -2843,12 +2843,19 @@ static int handle_renames(struct merge_options *o,
        head_pairs = get_diffpairs(o, common, head);
        merge_pairs = get_diffpairs(o, common, merge);
 
-       dir_re_head = get_directory_renames(head_pairs, head);
-       dir_re_merge = get_directory_renames(merge_pairs, merge);
+       if (o->detect_directory_renames) {
+               dir_re_head = get_directory_renames(head_pairs, head);
+               dir_re_merge = get_directory_renames(merge_pairs, merge);
 
-       handle_directory_level_conflicts(o,
-                                        dir_re_head, head,
-                                        dir_re_merge, merge);
+               handle_directory_level_conflicts(o,
+                                                dir_re_head, head,
+                                                dir_re_merge, merge);
+       } else {
+               dir_re_head  = xmalloc(sizeof(*dir_re_head));
+               dir_re_merge = xmalloc(sizeof(*dir_re_merge));
+               dir_rename_init(dir_re_head);
+               dir_rename_init(dir_re_merge);
+       }
 
        ri->head_renames  = get_renames(o, head_pairs,
                                        dir_re_merge, dir_re_head, head,
@@ -3541,6 +3548,7 @@ void init_merge_options(struct merge_options *o)
        o->renormalize = 0;
        o->diff_detect_rename = -1;
        o->merge_detect_rename = -1;
+       o->detect_directory_renames = 1;
        merge_recursive_config(o);
        merge_verbosity = getenv("GIT_MERGE_VERBOSITY");
        if (merge_verbosity)
index fa7bc6b6836f99ab9c417e2865cd5a544488d025..e39ee5d78be6bb460bef18aac61deb1ca9b55da0 100644 (file)
@@ -18,6 +18,7 @@ struct merge_options {
        unsigned renormalize : 1;
        long xdl_opts;
        int verbosity;
+       int detect_directory_renames;
        int diff_detect_rename;
        int merge_detect_rename;
        int diff_rename_limit;