Hi Erik On 28/11/2026 12:13, Erik Cervin-Edin wrote:
> 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.
This looks as I expected, I don't have anything to add to Junio's comments. Thanks for working on it Phillip
> 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/cove…@cervined.in/ > [2] https://lore.kernel.org/git/cove…@cervined.in/ > [3] https://lore.kernel.org/git/cove…@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