]> git.ipfire.org Git - thirdparty/git.git/commit
merge-recursive: avoid directory rename detection in recursive case
authorElijah Newren <newren@gmail.com>
Mon, 5 Aug 2019 22:33:50 +0000 (15:33 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 6 Aug 2019 17:42:36 +0000 (10:42 -0700)
commitff6d54771af2c92867f773a264200f22b4cb2ab9
tree13324e6ddcd4623d514d19ce2a865b53a581df7d
parent4d8ec15c66f32e29e4dfcdf64d0826c425d8ad7d
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>
merge-recursive.c
t/t6043-merge-rename-directories.sh