merge-recursive: avoid directory rename detection in recursive case
Ever since commit 8c8e5bd6eb
("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>
This commit is contained in:

committed by
Junio C Hamano

parent
4d8ec15c66
commit
ff6d54771a
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user