git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Could #-ignoring in commit message be smarter?

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Sep 4, 2010, 22:24 UTC
Message-ID
<AANLkTimgt6kjTkc+gxyOmTz03bdnfiRzgt4p8vymQ=VY@mail.gmail.com>
On Sat, Sep 4, 2010 at 21:55, Sverre Rabbelier <srabbelier@gmail.com> wrote:
Show 8 quoted lines
> Heya,
>
> On Sat, Sep 4, 2010 at 16:37, Ramana Kumar <ramana.kumar@gmail.com> wrote:
>> The commit message message says "Lines starting with '#' will be
>> ignored", but fails to say "Lines below this message will be ignored,
>> even if they don't start with '#'".
>
> Because they're not. Only those starting with # are ignored.

Which also sucks a bit. I've been bit by writing commits messages like this numerous times:

    parser: fix non-\W issues
    This change is here to fix screwups of special characters like %, !,
    #, ^ and other non-\W chars.
    These characters screw up our parser.
    # Please enter the commit message for your changes. Lines starting
    # with '#' will be ignored, and an empty message aborts the commit.
    # On branch master
    # Changes to be committed:
    #   (use "git reset HEAD <file>..." to unstage)
    #
    #   modified:   parser.c

Where I'm referencing the #-character in the commit message itself for some reason, and due to word wrapping it just *happens* to end up at the start of a line. So the commit message silently becomes:

    parser: fix non-\W issues
    This change is here to fix screwups of special characters like %, !,
    These characters screw up our parser.

The main reason for why this probably can't be fixed is that we've painted ourselves into a corner with git rebase -i squash and fixup messages, which will insert comments themselves.

Still *maybe* we could handle this better for the common case. E.g. if we're *not* inside a rebase only ignore the continuous and unbroken lines starting with # at the bottom. But that'd probably break something I'm not thinking of.

Next: Sverre Rabbelier
Message 1 of 3 in “Could #-ignoring in commit message be smarter?”
  1. Ævar Arnfjörð BjarmasonSep 4, 2010
  2. Sverre RabbelierSep 4, 2010
  3. Ævar Arnfjörð BjarmasonSep 4, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.