summaryrefslogtreecommitdiff
path: root/t/t6045-merge-rename-delete.sh
diff options
context:
space:
mode:
authorMatt McCutchen <matt@mattmccutchen.net>2017-01-28 20:37:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-01-30 22:07:08 (GMT)
commitb26d87f2da22a5970b15bebe588bcd6ccac98e9b (patch)
tree81079e557d06e4bf712de54b7898261751cef7a8 /t/t6045-merge-rename-delete.sh
parentad36dc8b4b165bf9eb3576b42a241164e312d48c (diff)
downloadgit-b26d87f2da22a5970b15bebe588bcd6ccac98e9b.zip
git-b26d87f2da22a5970b15bebe588bcd6ccac98e9b.tar.gz
git-b26d87f2da22a5970b15bebe588bcd6ccac98e9b.tar.bz2
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>
Diffstat (limited to 't/t6045-merge-rename-delete.sh')
-rwxr-xr-xt/t6045-merge-rename-delete.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t6045-merge-rename-delete.sh b/t/t6045-merge-rename-delete.sh
new file mode 100755
index 0000000..5d33577
--- /dev/null
+++ b/t/t6045-merge-rename-delete.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+test_description='Merge-recursive rename/delete conflict message'
+. ./test-lib.sh
+
+test_expect_success 'rename/delete' '
+ echo foo >A &&
+ git add A &&
+ git commit -m "initial" &&
+
+ git checkout -b rename &&
+ git mv A B &&
+ git commit -m "rename" &&
+
+ git checkout master &&
+ git rm A &&
+ git commit -m "delete" &&
+
+ test_must_fail git merge --strategy=recursive rename >output &&
+ test_i18ngrep "CONFLICT (rename/delete): A deleted in HEAD and renamed to B in rename. Version rename of B left in tree." output
+'
+
+test_done