]> git.ipfire.org Git - thirdparty/git.git/commit - merge-recursive.c
merge-recursive: make "CONFLICT (rename/delete)" message show both paths
authorMatt McCutchen <matt@mattmccutchen.net>
Sat, 28 Jan 2017 20:37:01 +0000 (15:37 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Jan 2017 22:07:08 +0000 (14:07 -0800)
commitb26d87f2da22a5970b15bebe588bcd6ccac98e9b
tree81079e557d06e4bf712de54b7898261751cef7a8
parentad36dc8b4b165bf9eb3576b42a241164e312d48c
merge-recursive: make "CONFLICT (rename/delete)" message show both paths

The current message printed by "git merge-recursive" for a rename/delete
conflict is like this:

CONFLICT (rename/delete): new-path deleted in HEAD and renamed in
other-branch. Version other-branch of new-path left in tree.

To be more helpful, the message should show both paths of the rename and
state that the deletion occurred at the old path, not the new path.  So
change the message to the following format:

CONFLICT (rename/delete): old-path deleted in HEAD and renamed to
new-path in other-branch. Version other-branch of new-path left in tree.

Since this doubles the number of cases in handle_change_delete (modify vs.
rename), refactor the code to halve the number of cases again by merging the
cases where o->branch1 has the change and o->branch2 has the delete with the
cases that are the other way around.

Also add a simple test of the new conflict message.

Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-recursive.c
t/t6045-merge-rename-delete.sh [new file with mode: 0755]