diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-08-01 01:44:08 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-08-01 02:13:49 +0300 |
commit | ed3789f2f0ab8b8d5e325e47f0caf02b6bd9edfc (patch) | |
tree | 2923c250df14404896089bde6ffa990ea276d66c /t/t7201-co.sh | |
parent | 54f98fee5069f50c6e96687504b82a7695c8648a (diff) |
checkout/restore: add basic tests for --merge
Even though "checkout --merge -- paths" had some tests, we never
made sure it worked to recreate the conflicted state _after_ the
resolution was recorded in the index. Also "restore --merge" did
not even have any tests.
Currently these commands use the unmerge_marked_index() interface
that cannot handle paths that have been resolved as removal, and
tests for that case are marked with test_expect_failure; these
should eventually be fixed, but not in this patch.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7201-co.sh')
-rwxr-xr-x | t/t7201-co.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 23d4dadbcc..4b07a26c14 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -522,6 +522,48 @@ test_expect_success 'checkout with --merge' ' test_cmp merged file ' +test_expect_success 'checkout -m works after (mistaken) resolution' ' + setup_conflicting_index && + echo "none of the above" >sample && + cat sample >fild && + cat sample >file && + cat sample >filf && + # resolve to something + git add file && + git checkout --merge -- fild file filf && + { + echo "<<<<<<< ours" && + echo ourside && + echo "=======" && + echo theirside && + echo ">>>>>>> theirs" + } >merged && + test_cmp expect fild && + test_cmp expect filf && + test_cmp merged file +' + +test_expect_failure 'checkout -m works after (mistaken) resolution to remove' ' + setup_conflicting_index && + echo "none of the above" >sample && + cat sample >fild && + cat sample >file && + cat sample >filf && + # resolve to remove + git rm file && + git checkout --merge -- fild file filf && + { + echo "<<<<<<< ours" && + echo ourside && + echo "=======" && + echo theirside && + echo ">>>>>>> theirs" + } >merged && + test_cmp expect fild && + test_cmp expect filf && + test_cmp merged file +' + test_expect_success 'checkout with --merge, in diff3 -m style' ' git config merge.conflictstyle diff3 && setup_conflicting_index && |