Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-08-01 01:44:07 +0300
committerJunio C Hamano <gitster@pobox.com>2023-08-01 02:10:54 +0300
commit54f98fee5069f50c6e96687504b82a7695c8648a (patch)
tree744883c40121a184bece4e5cffffb913ed29e0fa /t/t7201-co.sh
parentc0a4ae7f4e010204f8341dcc3b9217dd42baee14 (diff)
checkout/restore: refuse unmerging paths unless checking out of the index
Recreating unmerged index entries using resolve-undo data, recreating conflicted working tree files using unmerged index entries, and writing data out of unmerged index entries, make sense only when we are checking paths out of the index and not when we are checking paths out of a tree-ish. Add an extra check to make sure "--merge" and "--ours/--theirs" options are rejected when checking out from a tree-ish, update the document (especially the SYNOPSIS section) to highlight that they are incompatible, and add a few tests to make sure the combination fails. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7201-co.sh')
-rwxr-xr-xt/t7201-co.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 61ad47b0c1..23d4dadbcc 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 &&