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 <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren 2020-08-10 22:29:17 +00:00 коммит произвёл Junio C Hamano
Родитель 1cb588775f
Коммит 2a7c16c980
2 изменённых файлов: 14 добавлений и 9 удалений

Просмотреть файл

@ -457,7 +457,7 @@ test_expect_success 'handle rename-with-content-merge vs. add' '
git checkout A^0 && git checkout A^0 &&
test_must_fail git merge -s recursive B^0 >out && test_must_fail git merge -s recursive B^0 >out &&
test_i18ngrep "CONFLICT (rename/add)" out && test_i18ngrep "CONFLICT (.*/add)" out &&
git ls-files -s >out && git ls-files -s >out &&
test_line_count = 2 out && test_line_count = 2 out &&
@ -503,7 +503,7 @@ test_expect_success 'handle rename-with-content-merge vs. add, merge other way'
git checkout B^0 && git checkout B^0 &&
test_must_fail git merge -s recursive A^0 >out && test_must_fail git merge -s recursive A^0 >out &&
test_i18ngrep "CONFLICT (rename/add)" out && test_i18ngrep "CONFLICT (.*/add)" out &&
git ls-files -s >out && git ls-files -s >out &&
test_line_count = 2 out && test_line_count = 2 out &&
@ -886,12 +886,17 @@ test_expect_failure 'rad-check: rename/add/delete conflict' '
git checkout B^0 && git checkout B^0 &&
test_must_fail git merge -s recursive A^0 >out 2>err && test_must_fail git merge -s recursive A^0 >out 2>err &&
# Not sure whether the output should contain just one # Instead of requiring the output to contain one combined line
# "CONFLICT (rename/add/delete)" line, or if it should break # CONFLICT (rename/add/delete)
# it into a pair of "CONFLICT (rename/delete)" and # or perhaps two lines:
# "CONFLICT (rename/add)"; allow for either. # CONFLICT (rename/add): new file collides with rename target
test_i18ngrep "CONFLICT (rename.*add)" out && # CONFLICT (rename/delete): rename source removed on other side
test_i18ngrep "CONFLICT (rename.*delete)" out && # and instead of requiring "rename/add" instead of "add/add",
# be flexible in the type of console output message(s) reported
# for this particular case; we will be more stringent about the
# contents of the index and working directory.
test_i18ngrep "CONFLICT (.*/add)" out &&
test_i18ngrep "CONFLICT (rename.*/delete)" out &&
test_must_be_empty err && test_must_be_empty err &&
git ls-files -s >file_count && git ls-files -s >file_count &&

Просмотреть файл

@ -374,7 +374,7 @@ test_expect_success '2c: Modify b & add c VS rename b->c' '
export GIT_MERGE_VERBOSITY && export GIT_MERGE_VERBOSITY &&
test_must_fail git merge -s recursive B^0 >out 2>err && test_must_fail git merge -s recursive B^0 >out 2>err &&
test_i18ngrep "CONFLICT (rename/add): Rename b->c" out && test_i18ngrep "CONFLICT (.*/add):" out &&
test_must_be_empty err && test_must_be_empty err &&
# Make sure c WAS updated # Make sure c WAS updated