From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id B4ADD1F4B4 for ; Mon, 5 Apr 2021 22:24:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241459AbhDEWXq (ORCPT ); Mon, 5 Apr 2021 18:23:46 -0400 Received: from pb-smtp2.pobox.com ([64.147.108.71]:59208 "EHLO pb-smtp2.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233086AbhDEWXp (ORCPT ); Mon, 5 Apr 2021 18:23:45 -0400 Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 4DF61AA306; Mon, 5 Apr 2021 18:23:38 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=5Ak9/HGJWdqxhWL2f+T2G2/Ofzg=; b=s3C7I0 m2bXA1zyaSbL1ooJw9KCxSVweZZh02ctHqHB/KSWaAHqm+XAY4UBL/yk5Aa4YsLq Yb3LDv+7PJzQDPHDwEj7gWCAvq0dIkbnmeJ34ZcOKYReT+IxAZshv1WsgakYDvh8 HbaiuzADBkYMguZuVK1nBS7H70HyYCI4RJfX4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=w1IQYKzf5lCs9mW+bxcjM1igEQBGqoAu pes2dPJJUdt7A4kmlEur7xt1YE6gqhHoo9h6Cp3v+9ZXxJqZrthHOuE4c6Zh0+lA l9s3HQBdZ018mw4BLmgFoECMTJi5NcSn/ooDI4JQkbEgWZHaqIKQvE1OFZdw/f7g uTfjA2XyDhI= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 42EA7AA305; Mon, 5 Apr 2021 18:23:38 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.74.119.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id B0F54AA304; Mon, 5 Apr 2021 18:23:37 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Jerry Zhang Cc: Elijah Newren , Git Mailing List , Ross Yeager , Abraham Bachrach , Jerry Zhang , Brian Kubisiak Subject: Re: [PATCH 1/1] git-apply: Allow simultaneous --cached and --3way options References: <20210403013410.32064-1-jerry@skydio.com> <20210403013410.32064-2-jerry@skydio.com> Date: Mon, 05 Apr 2021 15:23:36 -0700 In-Reply-To: (Jerry Zhang's message of "Mon, 5 Apr 2021 15:12:43 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 91389CFE-965D-11EB-8DC9-74DE23BA3BAF-77302942!pb-smtp2.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Jerry Zhang writes: > I can see what you mean about the user safety issue. However, > my specific use case (see cover letter) involves an index that does not > match HEAD, and wouldn't be possible at all if we forced the index to > match HEAD. Furthermore git-apply --cached even without --3way > doesn't force the index to match HEAD either, so why force it now? Primarily because we tend to be extra careful before mergy operation than any other operation. Especially without --3way, apply (with or without --cached/--index) is extra careful to make itself all-or-none operation to be safe, so that there is no mixed mess that requires manual intervention (which would further increase the risk of mistakes). It is OK to introduce a new option to allow a dirty index, and your tool can pass that option when it calls "apply --cached --3way", but it would be safe to require a clean index (it does not matter how dirty the working tree is ;-) by default.