]> git.ipfire.org Git - thirdparty/git.git/commit
sequencer: comment commit messages properly
authorKristoffer Haugsbakk <code@khaugsbakk.name>
Mon, 25 Nov 2024 20:13:13 +0000 (21:13 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 26 Nov 2024 01:05:08 +0000 (10:05 +0900)
commit7e2f377b03b0d3593df73a094f97c27b219b02f5
treef3181031357fab1042d67e783b3431b9fa53edab
parent515d034f8d922602b9d417cdc02768757aa6f6c1
sequencer: comment commit messages properly

The rebase todo editor has commands like `fixup -c` which affects
the commit messages of the rebased commits.[1]  For example:

    pick hash1 <msg>
    fixup hash2 <msg>
    fixup -c hash3 <msg>

This says that hash2 and hash3 should be squashed into hash1 and
that hash3’s commit message should be used for the resulting commit.
So the user is presented with an editor where the two first commit
messages are commented out and the third is not.  However this does
not work if `core.commentChar`/`core.commentString` is in use since
the comment char is hardcoded (#) in this `sequencer.c` function.
As a result the first commit message will not be commented out.

† 1: See 9e3cebd97cb (rebase -i: add fixup [-C | -c] command,
    2021-01-29)

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Co-authored-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Reported-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
t/t3437-rebase-fixup-options.sh