From 54f98fee5069f50c6e96687504b82a7695c8648a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 31 Jul 2023 15:44:07 -0700 Subject: [PATCH] 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 --- Documentation/git-checkout.txt | 9 ++++++--- Documentation/git-restore.txt | 4 ++++ builtin/checkout.c | 9 +++++++++ t/t2070-restore.sh | 7 +++++-- t/t7201-co.sh | 5 +++++ 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 4af0904f47..a30e3ebc51 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -12,8 +12,10 @@ SYNOPSIS 'git checkout' [-q] [-f] [-m] --detach [] 'git checkout' [-q] [-f] [-m] [--detach] 'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] ] [] -'git checkout' [-f|--ours|--theirs|-m|--conflict=