diff options
author | Elijah Newren <newren@gmail.com> | 2020-10-26 17:01:42 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-10-26 12:31:24 -0700 |
commit | 23bef2e33c3290ae308c2ce37e290a25eb5b97bc (patch) | |
tree | b76387d6869f0c2fa5f497c860586e554707cb7f /t/t6436-merge-overwrite.sh | |
parent | c8c35f6a02f3841d4383a5ce4c9d8e426776d151 (diff) | |
download | git-23bef2e33c3290ae308c2ce37e290a25eb5b97bc.tar.gz |
t6423, t6436: note improved ort handling with dirty files
The "recursive" backend relies on unpack_trees() to check if unstaged
changes would be overwritten by a merge, but unpack_trees() does not
understand renames -- and once it returns, it has already written many
updates to the working tree and index. As such, "recursive" had to do a
special 4-way merge where it would need to also treat the working copy
as an extra source of differences that we had to carefully avoid
overwriting and resulting in moving files to new locations to avoid
conflicts.
The "ort" backend, by contrast, does the complete merge inmemory, and
only updates the index and working copy as a post-processing step. If
there are dirty files in the way, it can simply abort the merge.
Update t6423 and t6436 to reflect the better merge abilities and
expectations we have for ort, while still leaving the
best-case-as-good-as-recursive-can-do expectations there for the
recursive backend so we retain its stability until we are ready to
deprecate and remove it.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6436-merge-overwrite.sh')
-rwxr-xr-x | t/t6436-merge-overwrite.sh | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/t/t6436-merge-overwrite.sh b/t/t6436-merge-overwrite.sh index dd8ab7ede1..dd9376842f 100755 --- a/t/t6436-merge-overwrite.sh +++ b/t/t6436-merge-overwrite.sh @@ -97,11 +97,19 @@ test_expect_success 'will not overwrite unstaged changes in renamed file' ' git mv c1.c other.c && git commit -m rename && cp important other.c && - test_must_fail git merge c1a >out && - test_i18ngrep "Refusing to lose dirty file at other.c" out && - test_path_is_file other.c~HEAD && - test $(git hash-object other.c~HEAD) = $(git rev-parse c1a:c1.c) && - test_cmp important other.c + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + test_must_fail git merge c1a >out 2>err && + test_i18ngrep "would be overwritten by merge" err && + test_cmp important other.c && + test_path_is_missing .git/MERGE_HEAD + else + test_must_fail git merge c1a >out && + test_i18ngrep "Refusing to lose dirty file at other.c" out && + test_path_is_file other.c~HEAD && + test $(git hash-object other.c~HEAD) = $(git rev-parse c1a:c1.c) && + test_cmp important other.c + fi ' test_expect_success 'will not overwrite untracked subtree' ' |