Skip to content

Commit 2a7c16c

Browse files
newrengitster
authored andcommitted
t6422, t6426: be more flexible for add/add conflicts involving renames
merge-recursive treats an add/add conflict where one of the adds came from a rename as a separate 'rename/add' type of conflict. However, if there is not content conflict after the content merge(s), then the file is not considered to be conflicted. That suggests the conflict type is really just add/add. Other merge engines might choose to print messages to the console that just refer to these as add/add conflicts; accept both types of output. Note: it could help to notify users if the three-way content merge of the rename had content conflicts, because when we then go to two-way merge THAT with the conflicting add we can get nested conflict markers. merge-recursive, unfortunately, doesn't do that, but other merge engines could. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1cb5887 commit 2a7c16c

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

t/t6422-merge-rename-corner-cases.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ test_expect_success 'handle rename-with-content-merge vs. add' '
457457
git checkout A^0 &&
458458
459459
test_must_fail git merge -s recursive B^0 >out &&
460-
test_i18ngrep "CONFLICT (rename/add)" out &&
460+
test_i18ngrep "CONFLICT (.*/add)" out &&
461461
462462
git ls-files -s >out &&
463463
test_line_count = 2 out &&
@@ -503,7 +503,7 @@ test_expect_success 'handle rename-with-content-merge vs. add, merge other way'
503503
git checkout B^0 &&
504504
505505
test_must_fail git merge -s recursive A^0 >out &&
506-
test_i18ngrep "CONFLICT (rename/add)" out &&
506+
test_i18ngrep "CONFLICT (.*/add)" out &&
507507
508508
git ls-files -s >out &&
509509
test_line_count = 2 out &&
@@ -886,12 +886,17 @@ test_expect_failure 'rad-check: rename/add/delete conflict' '
886886
git checkout B^0 &&
887887
test_must_fail git merge -s recursive A^0 >out 2>err &&
888888
889-
# Not sure whether the output should contain just one
890-
# "CONFLICT (rename/add/delete)" line, or if it should break
891-
# it into a pair of "CONFLICT (rename/delete)" and
892-
# "CONFLICT (rename/add)"; allow for either.
893-
test_i18ngrep "CONFLICT (rename.*add)" out &&
894-
test_i18ngrep "CONFLICT (rename.*delete)" out &&
889+
# Instead of requiring the output to contain one combined line
890+
# CONFLICT (rename/add/delete)
891+
# or perhaps two lines:
892+
# CONFLICT (rename/add): new file collides with rename target
893+
# CONFLICT (rename/delete): rename source removed on other side
894+
# and instead of requiring "rename/add" instead of "add/add",
895+
# be flexible in the type of console output message(s) reported
896+
# for this particular case; we will be more stringent about the
897+
# contents of the index and working directory.
898+
test_i18ngrep "CONFLICT (.*/add)" out &&
899+
test_i18ngrep "CONFLICT (rename.*/delete)" out &&
895900
test_must_be_empty err &&
896901
897902
git ls-files -s >file_count &&

t/t6426-merge-skip-unneeded-updates.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ test_expect_success '2c: Modify b & add c VS rename b->c' '
374374
export GIT_MERGE_VERBOSITY &&
375375
test_must_fail git merge -s recursive B^0 >out 2>err &&
376376
377-
test_i18ngrep "CONFLICT (rename/add): Rename b->c" out &&
377+
test_i18ngrep "CONFLICT (.*/add):" out &&
378378
test_must_be_empty err &&
379379
380380
# Make sure c WAS updated

0 commit comments

Comments
 (0)