Git development
 help / color / mirror / Atom feed
From: Erik Cervin-Edin <erik@cervined.in>
To: git@vger.kernel.org
Cc: gitster@pobox.com, phillip.wood123@gmail.com,
	Erik Cervin-Edin <erik@cervined.in>
Subject: [PATCH v5 0/3] commit: allow -m/-F/-c/-C for all --fixup variants
Date: Sat, 28 Nov 2026 13:13:56 +0100	[thread overview]
Message-ID: <cover.1795867565.git.erik@cervined.in> (raw)
In-Reply-To: <cover.1795562078.git.erik@cervined.in>

Changes since v4:

  * 3/3: plain --fixup -c now opens the editor, as -c does everywhere
    else.  v4 kept plain --fixup's existing no-editor behavior, which
    meant -c silently acted like -C.

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/3 is a preparatory refactor that writes the --fixup subject before
    choosing the message source, like --squash does.

  * 2/3 lets -m and -F supply the message for all --fixup variants.

  * 3/3 does the same for -c/-C, so that all four message sources behave
    consistently across the plain, amend, and reword forms.

As in v3 and v4, -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.  The helper only knows about
"amend!" and not "fixup!" or "squash!"; that is pre-existing and I have
left it alone here.

The earlier rounds are described in the v2 [1], v3 [2] and v4 [3]
cover letters.

[1] https://lore.kernel.org/git/cover.1779792311.git.erik@cervined.in/
[2] https://lore.kernel.org/git/cover.1790082176.git.erik@cervined.in/
[3] https://lore.kernel.org/git/cover.1795562078.git.erik@cervined.in/

Erik Cervin-Edin (3):
  commit: write the --fixup subject the way --squash does
  commit: allow -m/-F for all --fixup variants
  commit: allow -c/-C for all --fixup variants

 Documentation/git-commit.adoc             |  22 +++--
 builtin/commit.c                          |  64 ++++++------
 t/t7500-commit-template-squash-signoff.sh | 114 +++++++++++++++++++---
 3 files changed, 140 insertions(+), 60 deletions(-)

Range-diff against v4:
1:  ebae1fbe05 = 1:  ebae1fbe05 commit: write the --fixup subject the way --squash does
2:  051b659965 = 2:  051b659965 commit: allow -m/-F for all --fixup variants
3:  159a56c510 ! 3:  9ab3665cfc commit: allow -c/-C for all --fixup variants
    @@ Commit message
         autosquash.  This also means that "git commit --fixup=amend:X -C X"
         produces the same message as "GIT_EDITOR=: git commit --fixup=amend:X".
     
    -    Plain --fixup never opens an editor, so -c there behaves like -C.
    +    Plain --fixup turns the editor off.  Keep it on when using -c, so that
    +    -c isn't silently treated like -C.
     
         The incompatibility check grouping -C, -c, and --fixup can go away
         entirely, as -C and -c are already rejected together by the check that
    @@ builtin/commit.c: static int parse_and_validate_options(int argc, const char *ar
      	die_for_incompatible_opt4(have_option_m, "-m",
      				  !!edit_message, "-c",
      				  !!use_message, "-C",
    +@@ builtin/commit.c: 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;
    + 		}
    + 	}
    + 
     
      ## t/t7500-commit-template-squash-signoff.sh ##
     @@ t/t7500-commit-template-squash-signoff.sh: test_expect_success 'commit --fixup works with -F' '

base-commit: f7de81456940dd6f3274e461149bba12965de609
-- 
2.56.1.978.gcc9bcf3eaa

  parent reply	other threads:[~2026-11-28 12:14 UTC|newest]

Thread overview: 34+ 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       ` Erik Cervin-Edin [this message]
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-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-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=cover.1795867565.git.erik@cervined.in \
    --to=erik@cervined.in \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood123@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox