From patchwork Mon Jul 31 22:44:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junio C Hamano X-Patchwork-Id: 13335574 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65BE9C001E0 for ; Mon, 31 Jul 2023 22:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230021AbjGaWsU (ORCPT ); Mon, 31 Jul 2023 18:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230038AbjGaWsR (ORCPT ); Mon, 31 Jul 2023 18:48:17 -0400 Received: from pb-smtp1.pobox.com (pb-smtp1.pobox.com [64.147.108.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD2731BCF for ; Mon, 31 Jul 2023 15:48:15 -0700 (PDT) Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 3C8541ACBBB; Mon, 31 Jul 2023 18:44:23 -0400 (EDT) (envelope-from gitster@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=c9PvQDag02zrKQkRZZwvSwlRH UsAW/GiYiOQ/ADJD88=; b=de9850q++k52b3t8Jc/UfpfmUJZXlSt26cQYlo6w8 vRQRkILuLugjxOOF1QUDbJoVUKyppqJQxG52lqIVTBUCAnuXowRwvhZt85P3uIrj LSEDH+7NnFt8xuvc8Sl+gDuLSRQIqHEcqpZAgZgKaRbGVk0yTtjq8JygBxvYjJaZ fY= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 355C31ACBBA; Mon, 31 Jul 2023 18:44:23 -0400 (EDT) (envelope-from gitster@pobox.com) Received: from pobox.com (unknown [34.168.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 97CC11ACBB9; Mon, 31 Jul 2023 18:44:22 -0400 (EDT) (envelope-from gitster@pobox.com) From: Junio C Hamano To: git@vger.kernel.org Subject: [PATCH 5/7] checkout/restore: refuse unmerging paths unless checking out of the index Date: Mon, 31 Jul 2023 15:44:07 -0700 Message-ID: <20230731224409.4181277-6-gitster@pobox.com> X-Mailer: git-send-email 2.41.0-478-gee48e70a82 In-Reply-To: <20230731224409.4181277-1-gitster@pobox.com> References: <20230731224409.4181277-1-gitster@pobox.com> MIME-Version: 1.0 X-Pobox-Relay-ID: CB1DE21C-2FF3-11EE-BFDE-C65BE52EC81B-77302942!pb-smtp1.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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=