]> git.ipfire.org Git - thirdparty/git.git/commit - merge-recursive.c
merge-recursive: fix rename/add conflict handling
authorElijah Newren <newren@gmail.com>
Thu, 8 Nov 2018 04:40:26 +0000 (20:40 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Nov 2018 05:23:53 +0000 (14:23 +0900)
commit7f8671656f31f5d1cc9d9748b7dc62b76a428cc5
tree89131f74d4a4c5af40818e9f212506bf4c76678f
parent37b65ce36bc8f79b5e8cf6f3addf586bd72f3352
merge-recursive: fix rename/add conflict handling

This makes the rename/add conflict handling make use of the new
handle_file_collision() function, which fixes several bugs and improves
things for the rename/add case significantly.  Previously, rename/add
would:

  * Not leave any higher order stage entries in the index, making it
    appear as if there were no conflict.
  * Would place the rename file at the colliding path, and move the
    added file elsewhere, which combined with the lack of higher order
    stage entries felt really odd.  It's not clear to me why the
    rename should take precedence over the add; if one should be moved
    out of the way, they both probably should.
  * In the recursive case, it would do a two way merge of the added
    file and the version of the renamed file on the renamed side,
    completely excluding modifications to the renamed file on the
    unrenamed side of history.

Use the new handle_file_collision() to fix all of these issues.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-recursive.c
t/t6036-recursive-corner-cases.sh
t/t6042-merge-rename-corner-cases.sh