diff options
author | Elijah Newren <newren@gmail.com> | 2019-08-05 15:33:50 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-08-06 10:42:36 -0700 |
commit | ff6d54771af2c92867f773a264200f22b4cb2ab9 (patch) | |
tree | 13324e6ddcd4623d514d19ce2a865b53a581df7d /merge-recursive.c | |
parent | RelNotes/2.21.1: typofix (diff) | |
download | tgif-ff6d54771af2c92867f773a264200f22b4cb2ab9.tar.xz |
merge-recursive: avoid directory rename detection in recursive case
Ever since commit 8c8e5bd6eb33 ("merge-recursive: switch directory
rename detection default", 2019-04-05), the default handling with
directory rename detection was to report a conflict and leave unstaged
entries in the index. However, when creating a virtual merge base in
the recursive case, we absolutely need a tree, and the only way a tree
can be written is if we have no unstaged entries -- otherwise we hit a
BUG().
There are a few fixes possible here which at least fix the BUG(), but
none of them seem optimal for other reasons; see the comments with the
new testcase 13e in t6043 for details (which testcase triggered a BUG()
prior to this patch). As such, just opt for a very conservative and
simple choice that is still relatively reasonable: have the recursive
case treat 'conflict' as 'false' for opt->detect_directory_renames.
Reported-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r-- | merge-recursive.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index d2e380b7ed..c7691d9b54 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -2856,7 +2856,8 @@ static int detect_and_process_renames(struct merge_options *opt, head_pairs = get_diffpairs(opt, common, head); merge_pairs = get_diffpairs(opt, common, merge); - if (opt->detect_directory_renames) { + if ((opt->detect_directory_renames == 2) || + (opt->detect_directory_renames == 1 && !opt->call_depth)) { dir_re_head = get_directory_renames(head_pairs); dir_re_merge = get_directory_renames(merge_pairs); |