From: Erik Cervin-Edin <erik@cervined.in>
To: phillip.wood@dunelm.org.uk
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH v5 3/3] commit: allow -c/-C for all --fixup variants
Date: Sat, 5 Dec 2026 13:58:35 +0100 [thread overview]
Message-ID: <axQGP4gMO2-Kxqwt@vader> (raw)
In-Reply-To: <17b979e8-670d-4fb5-85bd-17a744a4487e@gmail.com>
On 30/11/26 14:28, Phillip Wood wrote:
> On 29/11/2026 18:34, Junio C Hamano wrote:
> > I however do not see this combination of --fixup and -c covered in new
> > tests in t7500. Should we have one, or is it too trivial?
Given the main motivation for allowing this was to simplify the logic
rather than a need for either --fixup -c or -C, adding full test
coverage seemed unnecessary.
> It would be nice, but I'm not sure it is essential, it seems a pretty
> obscure combination of options.
That said, it's cheap, so I propose to flip the 'commit --fixup works
with -C' test into 'commit --fixup works with -c':
diff --git a/t/t7500-commit-template-squash-signoff.sh b/t/t7500-commit-template-squash-signoff.sh
index b9f02d3d2a..510dd11e1e 100755
--- a/t/t7500-commit-template-squash-signoff.sh
+++ b/t/t7500-commit-template-squash-signoff.sh
@@ -492,13 +492,15 @@ test_expect_success 'commit --fixup works with -F' '
EOF
'
-test_expect_success 'commit --fixup works with -C' '
+test_expect_success 'commit --fixup works with -c' '
commit_for_rebase_autosquash_setup &&
- GIT_EDITOR=false git commit --fixup HEAD~ -C HEAD &&
+ GIT_EDITOR="echo edited >>" git commit --fixup HEAD~ -c HEAD &&
test_commit_message HEAD <<-EOF
fixup! $(git log -1 --format=%s HEAD~2)
$(get_commit_msg HEAD~)
+
+ edited
EOF
'
Dropping the -C test loses little: the editor staying closed for plain
--fixup is already checked by the test at line ~298:
test_expect_success 'commit --fixup provides correct one-line commit message' '
commit_for_rebase_autosquash_setup &&
EDITOR="echo ignored >>" git commit --fixup HEAD~1 &&
commit_msg_is "fixup! target message subject line"
'
In the admittedly unlikely event that someone reaches for a combination of
options, it seems more likely they would reach for -c, given that the
message here is purely for decorative purposes. E.g. "I'm making this
fixup for reason X, outlined in commit Y."
> > > Helped-by: Junio C Hamano <gitster@pobox.com>
> >
> > I do not think I deserve this line as much as others would.
Fair. Will credit Phillip instead in next round =)
> > > @@ -1396,7 +1401,8 @@ static int parse_and_validate_options(int argc, const char *argv[],
> > > } else {
> > > fixup_commit = fixup_message;
> > > fixup_prefix = "fixup";
> > > - use_editor = 0;
> > > + if (!edit_message)
> > > + use_editor = 0;
> > > }
> > > }
> >
> > Tricky but true. Naively if you do not have a message you would think
> > you want to use editor to give the user a chance to supply one, but that
> > is not how this part of the world works. It might deserve a short
> > in-code comment why disabling of use_editor is done here and only when
> > !edit_message to help future readers. I dunno.
Agreed, something like:
diff --git a/builtin/commit.c b/builtin/commit.c
index 2649506828..8230e71abd 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1401,6 +1401,10 @@ static int parse_and_validate_options(int argc, const char *argv[],
} else {
fixup_commit = fixup_message;
fixup_prefix = "fixup";
+ /*
+ * The fixup! message needs no edit, except with -c,
+ * which explicitly asks to edit it.
+ */
if (!edit_message)
use_editor = 0;
}
next prev parent reply other threads:[~2026-12-05 12:58 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 11:22 [PATCH 0/1] commit: allow -m/-F with --fixup=amend: or reword: erik
2026-05-18 11:22 ` [PATCH 1/1] " erik
2026-05-18 12:39 ` Junio C Hamano
2026-05-18 15:27 ` Phillip Wood
2026-05-24 15:00 ` Erik Cervin Edin
2026-05-26 10:47 ` [PATCH v2 0/2] commit: allow -m/-F/-c/-C for all --fixup variations erik
2026-05-26 10:47 ` [PATCH v2 1/2] commit: allow -m/-F for all kinds of --fixup erik
2026-05-26 10:47 ` [PATCH v2 2/2] commit: allow -c/-C " erik
2026-08-26 21:31 ` Junio C Hamano
2026-09-04 18:47 ` Erik Cervin Edin
2026-09-22 13:04 ` [PATCH v3 0/2] commit: allow -m/-F/-c/-C for all --fixup variations erik
2026-09-22 13:04 ` [PATCH v3 1/2] commit: allow -m/-F for all kinds of --fixup erik
2026-10-21 15:11 ` Phillip Wood
2026-09-22 13:04 ` [PATCH v3 2/2] commit: allow -c/-C " erik
2026-10-21 15:10 ` Phillip Wood
2026-10-21 15:13 ` [PATCH v3 0/2] commit: allow -m/-F/-c/-C for all --fixup variations Phillip Wood
2026-11-05 14:51 ` Erik Cervin-Edin
2026-11-09 10:54 ` Phillip Wood
2026-11-24 23:32 ` [PATCH v4 0/3] commit: allow -m/-F/-c/-C for all --fixup variants Erik Cervin-Edin
2026-11-24 23:32 ` [PATCH v4 1/3] commit: write the --fixup subject the way --squash does Erik Cervin-Edin
2026-11-24 23:32 ` [PATCH v4 2/3] commit: allow -m/-F for all --fixup variants Erik Cervin-Edin
2026-11-24 23:32 ` [PATCH v4 3/3] commit: allow -c/-C " Erik Cervin-Edin
2026-11-25 14:37 ` [PATCH v4 0/3] commit: allow -m/-F/-c/-C " Phillip Wood
2026-11-26 9:17 ` erik88
2026-11-26 15:07 ` Phillip Wood
2026-11-28 12:13 ` [PATCH v5 " Erik Cervin-Edin
2026-11-28 12:13 ` [PATCH v5 1/3] commit: write the --fixup subject the way --squash does Erik Cervin-Edin
2026-11-29 1:31 ` Junio C Hamano
2026-11-28 12:14 ` [PATCH v5 2/3] commit: allow -m/-F for all --fixup variants Erik Cervin-Edin
2026-11-29 1:51 ` Junio C Hamano
2026-12-05 12:55 ` Erik Cervin-Edin
2026-11-28 12:14 ` [PATCH v5 3/3] commit: allow -c/-C " Erik Cervin-Edin
2026-11-29 18:34 ` Junio C Hamano
2026-11-30 14:28 ` Phillip Wood
2026-12-05 12:58 ` Erik Cervin-Edin [this message]
2026-11-30 14:29 ` [PATCH v5 0/3] commit: allow -m/-F/-c/-C " Phillip Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=axQGP4gMO2-Kxqwt@vader \
--to=erik@cervined.in \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood@dunelm.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.