]> git.ipfire.org Git - thirdparty/git.git/commit
sequencer: share the squash message marker helpers and flags
authorHarald Nordgren <haraldnordgren@gmail.com>
Mon, 20 Jul 2026 08:27:03 +0000 (08:27 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 29 Jul 2026 17:36:55 +0000 (10:36 -0700)
commit8766c19eb465e01be5658e6aa7baf2a41f3ce393
tree595cf0c23807c28057fe080c80f030cba6ddb8b8
parent8f06b88ae597650c4c74d0fc0e18dc9245fa9b59
sequencer: share the squash message marker helpers and flags

When "git rebase -i" squashes commits it builds an editor template with a
"This is a combination of N commits." banner, a "This is the 1st/Nth
commit message:" header above each kept message (or a "will be skipped"
header for a dropped one), and a commented-out subject for any fixup!,
squash! or amend! commit. The banner, the headers and the
subject-commenting all live in static helpers in sequencer.c wired to the
rebase state, so no other command can present a squash the same way.

Pull the three pieces out into add_squash_combination_header(),
add_squash_message_header() (which takes a flag for the "will be skipped"
variant) and squash_subject_comment_len(), and use them from
update_squash_messages() and append_squash_message(). Also move the
todo_item_flags enum to the header, so a caller reading the output of
todo_list_rearrange_squash() can tell an amend! (TODO_REPLACE_FIXUP_MSG)
from a plain fixup!. A later change reuses all of this to give "git
history squash --reedit-message" the same template.

No change in behavior.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
sequencer.h