threads / discuss / 24978

Could #-ignoring in commit message be smarter?

Subject: Could #-ignoring in commit message be smarter?

## tl;dr

3 messages between Sep 4, 2010 and Sep 4, 2010.

replies: 2people: 2as markdown or json

Ævar Arnfjörð Bjarmason· Sep 4, 2010, 22:24 UTC · lore
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.

Sverre Rabbelier· Sep 4, 2010, 22:30 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: Could #-ignoring in commit message be smarter?

Heya,
On Sat, Sep 4, 2010 at 17:24, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> 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:

Isn't this rare enough that it's not really a problem? I mean, sure, when it happens it's a PITA, but it's about as painful as doing `git commit -m "Yay, it works!"` and having bash history magic blow it away. After a while you get used to it and either remember to escape the bang, or not use it?

-- 
Cheers,

Sverre Rabbelier
Ævar Arnfjörð Bjarmason· Sep 4, 2010, 22:44 UTC · re: Sverre Rabbelier · lore

Re: Could #-ignoring in commit message be smarter?

On Sat, Sep 4, 2010 at 22:30, Sverre Rabbelier <srabbelier@gmail.com> wrote:
Show 12 quoted lines
> Heya,
>
> On Sat, Sep 4, 2010 at 17:24, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
>> 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:
>
> Isn't this rare enough that it's not really a problem? I mean, sure,
> when it happens it's a PITA, but it's about as painful as doing `git
> commit -m "Yay, it works!"` and having bash history magic blow it
> away. After a while you get used to it and either remember to escape
> the bang, or not use it?

With the bash thing you *notice* it, but in most cases like these what you actually do is *not* notice it, then scratch your head a month later at a commit message that makes no sense.

Anyway, it's obviously not a huge issue since we don't have people complaining about it more often. But it's really annoying when it happens.

← back to recent threads