Article View: linux.kernel.git
Article #1052Re: [PATCH v3 0/2] commit: allow -m/-F/-c/-C for all --fixup variations
From: Phillip Wood
Date: Wed, 21 Oct 2026 15:13
Date: Wed, 21 Oct 2026 15:13
133 lines
17107 bytes
17107 bytes
Hi Erik
Sorry it has taken me so long to get round to commenting on these
patches. I think that supporting -m and -F with --fixup is useful and I
cannot see a reason not to support -C as well. I've left a couple of
comments, but the only thing I'm really worried about is calling
test_set_editor() outside of a subshell in the second patch.
Thanks
Phillip
On 22/09/2026 14:04, erik@cervined.in wrote:
> From: Erik Cervin-Edin <erik@cervined.in>
>
> Changes since v2:
>
> * 2/2: Junio noted [1] that after dropping --fixup from the
> -C/-c/--fixup incompatibility check, what remained (-C, -c, -F)
> was already rejected by the neighbouring die_for_incompatible_opt4()
> that groups those options with -m. The check is now removed
> entirely instead of being narrowed.
>
> * 2/2: reworded the log message to lead with why -c/-C are the odd
> ones out once 1/2 is in place, rather than with the check that
> happened to block them.
>
> * Rebased onto current master. 1/2 is unchanged apart from that.
>
> Background
> ----------
>
> Today only -m works with plain --fixup, and neither -m nor -F works
> with --fixup=amend: or --fixup=reword:, which makes those modes
> awkward to drive non-interactively. 1/2 threads -m and -F through
> prepare_to_commit() for all --fixup variations. 2/2 does the same for
> -c/-C, which were blocked by the same incompatibility check that
> caught -F, so that all four message sources behave consistently across
> the plain, amend, and reword forms.
>
> 2/2 lives in its own patch and I won't object if reviewers would
> rather drop it or take it separately.
>
> A note on one design decision in 2/2. -c/-C go through
> prepare_amend_commit(), so if the source commit is itself an "amend!"
> commit, its subject line is dropped and only the body is copied. This
> is what a no-source --fixup=amend:<commit> already does.
>
> I kept that on purpose. Under --fixup the subject is always generated
> by git, so whatever -C supplies ends up in the body, and the body of an
> amend! commit is the message destined for its target. Copying the
> "amend! X" line along with it would leave that line in the final
> message after autosquash. It also means
>
> git commit --fixup=amend:foo -C foo
>
> and
>
> GIT_EDITOR=: git commit --fixup=amend:foo
>
> produce the same commit.
>
> The helper only knows about "amend!" and not "fixup!" or "squash!".
> That is pre-existing and I have left it alone here.
>
> The v1 -> v2 changes (refactoring prepare_to_commit() instead of the
> special-cased file slurp in cmd_commit(), extending scope to -c/-C,
> and the smaller review fixes) are described in the v2 cover letter [2].
>
> [1] https://lore.kernel.org/git/xmqq1pbkefh0.fsf@gitster.g/
> [2] https://lore.kernel.org/git/cover.1779792311.git.erik@cervined.in/
>
> Erik Cervin-Edin (2):
> commit: allow -m/-F for all kinds of --fixup
> commit: allow -c/-C for all kinds of --fixup
>
> Documentation/git-commit.adoc | 22 +++--
> builtin/commit.c | 40 ++++----
> t/t7500-commit-template-squash-signoff.sh | 114 +++++++++++++++++++---
> 3 files changed, 131 insertions(+), 45 deletions(-)
>
> Range-diff against v2:
> 1: e9f07d49ee = 1: 4581f97cb7 commit: allow -m/-F for all kinds of --fixup
> 2: b3fc743abf ! 2: 39e408e147 commit: allow -c/-C for all kinds of --fixup
> @@ Metadata
> ## Commit message ##
> commit: allow -c/-C for all kinds of --fixup
>
> - The previous commit allowed -m and -F for all --fixup variations. The
> - -c/-C flags were blocked by the same higher-layer incompatibility check
> - that previously caught -F, namely die_for_incompatible_opt4() grouping
> - them with --fixup.
> + The fixup code path in prepare_to_commit() only knows how to take a
> + message body from -m or -F. Now that the previous commit allows -m and
> + -F for all --fixup variations, -c/-C are the odd ones out.
>
> - Drop --fixup from that check and route the resolved commit through
> - prepare_amend_commit() in the fixup path, mirroring the no-message-source
> - behaviour of --fixup=amend. With this in place, -m/-F/-c/-C all behave
> - consistently across the plain, amend, and reword --fixup forms.
> + Teach the fixup path to look up the ref given to -c/-C and seed its
> + message when preparing to amend the commit, mirroring what --fixup=amend
> + does when no message source is given. With this in place, -m/-F/-c/-C
> + all behave consistently across the plain, amend, and reword --fixup
> + forms.
>
> + The incompatibility check grouping -C, -c, and --fixup can go away
> + entirely, as -C and -c are already rejected together by the check that
> + groups them with -m and -F.
> +
> + Helped-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: Erik Cervin-Edin <erik@cervined.in>
>
> ## Documentation/git-commit.adoc ##
> @@ builtin/commit.c: static int prepare_to_commit(const char *index_file, const cha
> prepare_amend_commit(commit, &sb, &ctx);
> }
> @@ builtin/commit.c: static int parse_and_validate_options(int argc, const char *argv[],
> + }
> + if (fixup_message && squash_message)
> die(_("options '%s' and '%s' cannot be used together"), "--squash", "--fixup");
> - die_for_incompatible_opt3(!!use_message, "-C",
> - !!edit_message, "-c",
> +- die_for_incompatible_opt3(!!use_message, "-C",
> +- !!edit_message, "-c",
> - !!fixup_message, "--fixup");
> -+ !!logfile, "-F");
> die_for_incompatible_opt4(have_option_m, "-m",
> !!edit_message, "-c",
> !!use_message, "-C",
>
> base-commit: d38352cd43ab9745686d697872408bc3249a153f
Technical Details
Message-ID:
<ba174a25-f7bc-4a5d-918c-87229b2fb5f6@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-72734-linux-kernel-git=dewy.ruReferences:
<cover.1779792311.git.erik@cervined.in> <cover.1790082176.git.erik@cervined.in>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-72734-linux-kernel-git=dewy.ru
From: phillip.wood123@gmail.com (Phillip Wood)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v3 0/2] commit: allow -m/-F/-c/-C for all --fixup
variations
Date: Wed, 21 Oct 2026 16:13:16 +0100
Organization: Usenet Network
Message-ID: <ba174a25-f7bc-4a5d-918c-87229b2fb5f6@gmail.com>
References: <cover.1779792311.git.erik@cervined.in>
<cover.1790082176.git.erik@cervined.in>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="4178989"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:/0kf5k8+K2Osgth1KFzOnRZRO9A= sha256:Nascend9XZsCMMz8OcCXPUnlpd0Cef6IyQXHF1Peg9I=
sha1:KBSicHGBw1eqRX4uKkbOnIN8B14= sha256:4cJUNPwrWnRwcqDlXsTGNyavjP5X7l/wzF6zWFQTZl0=
Content-Language: en-US
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 4A8A411104D; Wed, 21 Oct 2026 18:19:14 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.148
X-Spam-Status: No, score=-3.148 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 2IG3LZ6Hpe0O;
Wed, 21 Oct 2026 18:19:11 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=git+bounces-72734-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id 00038111022; Wed, 21 Oct 2026 18:19:02 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sto.lore.kernel.org (Postfix) with ESMTP id 52DEF6059C6; Wed, 21 Oct 2026 15:13:24 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1792595601;
b=tCBO/YbxlmIkxLLZSPRSkx6fez+pl52aztP0oB7ZV+71YHZ7Ytl3vwphBPTjR5u0n41i
BV7/xmwNhAbqDmomumMCb18dOtN1u1wo1gz/FxMH9UTZ1odDJlCGt5TOVAWnb9H0NnUcZ
WuIh03rw3oHFv2c/UhuYN0w+FWMh/nQLft6p3Ifa2S/aj+NRkWKMDBk+4vLBmluEgUzF6
WStC/gp5395tEFNz0+inhUs2/l34Iw3S9pLOvrQ/f0yXmFFQsuMOqPUgBOCYRm9FgeJEA
SVuuixFabSAyRrsITaaTGw8YO5VfAgJyYI5/kgNXOGjvaIjvAzeS03vlaa9uO7liCAQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792595601;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Message-ID:Date:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:User-Agent:Reply-To:Subject:To:Cc:References:
Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=8QX3pGX4wtBrrmajgq6lWYpcuJJpdctGJKs7QlvtA6Y=;
b=TnZfX3iG8LFai7kCrFqnfADlw1DrWrfVbkd1qNi2frtmTLaRHLN09wdzuOLo4VZmdN0u
LD9S/+Jm6/Xy+yXN+yz1LKKQbOu6QuNa6ldJJTFUtbM242ojm+viXVLJLmUTQQ7YmCgnw
y2MUbW+fBtIYg5wXggnl2kY/gEIB46r+iHDEo/2AUeyBd9c9F9aA06TGaQCT2LqXrSXtf
JStV4Mcuyu2oI6BcUhcR76REwxtaLVU+vA8E0rMAcKhfXmjXEBOP4FNsOdjH9U1UEV9T4
Bb5CTY37s01gXpcewjYptUbVW5szIiagUsnTlzL16alqpLgxjvM0G3tqMtcY10f9HHw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b="X7vAeno/";
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 676EC606A320;
Wed, 21 Oct 2026 15:13:21 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=X7vAeno/
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.44
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1792595600;
b=zmibR+k2BXStIJgeukCRKHJCK1BLSIXQsTDcYjfR7qcpWvCc9dFdtxiBVy9aeM9M4dLI
hoJCrmvOXJIYuIkCz7RHXahrh/a6gtlTJbd546DtEXRv8wrIzG5lEQAEfE4hvGHHh3eSr
s6qb6tuxM5PTWZIf+l5zRqOm/B5otdELH+HZ2ItlygAcFIxnKaDxbfxdsCAPnnXvb+F2B
CH1rM7L63K9NFxnEhmNqBzsfUJYgwhtkVqjBUpTDPTMtimjpULiUv3bW0D06z2jshwhFL
YmDHdlzlYfe+FS16Zw7ztW1YHKde5v3a/MPEBH40eiaLS/Ak03wceSpvHuGjm10Zz2w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792595600;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Message-ID:Date:MIME-Version:User-Agent:Reply-To:Subject:To:Cc:
References:Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=8QX3pGX4wtBrrmajgq6lWYpcuJJpdctGJKs7QlvtA6Y=;
b=IZuMgZittxN1wPN8RJeaOwvswhkvTtRAKoQSCkavW23CWfegqFJndH/jCgcxHFIQZCF2
55YYKLAjmYTghF3nNAPRZOTyvkFIegbCMCnogMutYPhVG8EhwlzuXp29+ZuR+nPtQa55m
DS+SF4aw+03cGz+qA027HEVDB+K3zn8Lyuts6fVEpuQUN9qzwVqg/Uv7N7LFMBKbwqnkT
xOBEx3Q5K93g/5E2Ke8AW53Gpdaxd4tSpdBiQArpdTC4bAUbXoP1zsQXwxqbLEwphVSPx
R0AYdq+IThon5DIFn5ck3ObuhmmF8H3v/Uj41DJx5J2hcH4B+hhOf7HZi5v+6GcjEeQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b="X7vAeno/";
arc=none smtp.remote-ip=209.85.128.44
X-Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F6AE606A319
for <git@vger.kernel.org>; Wed, 21 Oct 2026 15:13:19 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1F6AE606A319
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-49d0da752ffso7160855e9.3
for <git@vger.kernel.org>; Wed, 21 Oct 2026 08:13:19 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792595598; x=1793200398; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:reply-to:user-agent
:mime-version:date:message-id:from:to:cc:subject:date:message-id
:reply-to:content-type;
bh=8QX3pGX4wtBrrmajgq6lWYpcuJJpdctGJKs7QlvtA6Y=;
b=X7vAeno/acTEF7hUScQA71csc/uILpj9zuoNQlIaSDz9KMajX1niQJUjnqnxLbXmZO
HAnmInVtZWI0rhWyDhHyQT2K4rmdF0K7UFITwfJGmNUuAUM8z1fTWQKlwRUIyXq7hbBW
KdxkMUHdmqXsPzjP2cqvgW4SZuYtRphunzsFTG9QGUlG0maNZE2wtOOLu27XwDRqk9/3
NNeEoSlmJWGz86GQduJ7saGwQbG2izgzZuouKpuYdxzXS9b2kPG1VzNf4IrWnSkeixuU
GFEJJQpkZmIgYOpnM38ujPM7oMp3rT3ZSAhZdiIxTbJSIYtxR5Owr/mFzg0f5jcTKHXx
958A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792595598; x=1793200398;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:reply-to:user-agent
:mime-version:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to:content-type;
bh=8QX3pGX4wtBrrmajgq6lWYpcuJJpdctGJKs7QlvtA6Y=;
b=vRpTteL14aW87jJBhXI9QZ3akWNxPRbX/835XDoBddKq3U7ngcDdDDVA4qclfvm9ON
3JsGRxK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tv/LfHVkbBIrkf8RCQwukDVtT3S3hyuUhK
//nOzy/65O+WSirLVmi2vysqQNK3BHbhRg==
X-Received: by 2002:a05:600c:4ecb:b0:4a1:a475:d885 with SMTP id 5b1f17b1804b1-4a1fdd24cf6mr50025105e9.34.1792595598248;
Wed, 21 Oct 2026 08:13:18 -0700 (PDT)
X-Received: from ?IPV6:2a0a:ef40:724:6601:f3ff:aebc:61f8:d91f? ([2a0a:ef40:724:6601:f3ff:aebc:61f8:d91f])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1fab85fc8sm99969985e9.14.2026.10.21.08.13.17
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Wed, 21 Oct 2026 08:13:17 -0700 (PDT)
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-Reply-To: phillip.wood@dunelm.org.uk
X-Cc: gitster@pobox.com
X-In-Reply-To: <cover.1790082176.git.erik@cervined.in>