diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-10-02 20:20:00 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-10-02 20:20:00 +0200 |
commit | 5bb67fb7ab035ef399d019440f184aee3608f3e7 (patch) | |
tree | bd3a7acf0d30c9531630eb4f23de4fdbc1d92310 /t/t7201-co.sh | |
parent | The thirteenth batch (diff) | |
parent | checkout: allow "checkout -m path" to unmerge removed paths (diff) | |
download | git-5bb67fb7ab035ef399d019440f184aee3608f3e7.tar.xz git-5bb67fb7ab035ef399d019440f184aee3608f3e7.zip |
Merge branch 'jc/unresolve-removal'
"checkout --merge -- path" and "update-index --unresolve path" did
not resurrect conflicted state that was resolved to remove path,
but now they do.
* jc/unresolve-removal:
checkout: allow "checkout -m path" to unmerge removed paths
checkout/restore: add basic tests for --merge
checkout/restore: refuse unmerging paths unless checking out of the index
update-index: remove stale fallback code for "--unresolve"
update-index: use unmerge_index_entry() to support removal
resolve-undo: allow resurrecting conflicted state that resolved to deletion
update-index: do not read HEAD and MERGE_HEAD unconditionally
Diffstat (limited to 't/t7201-co.sh')
-rwxr-xr-x | t/t7201-co.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 35b9e6ed6b..ebf273e843 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -497,6 +497,11 @@ test_expect_success 'checkout unmerged stage' ' test ztheirside = "z$(cat file)" ' +test_expect_success 'checkout path with --merge from tree-ish is a no-no' ' + setup_conflicting_index && + test_must_fail git checkout -m HEAD -- file +' + test_expect_success 'checkout with --merge' ' setup_conflicting_index && echo "none of the above" >sample && @@ -517,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_success '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 && |