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

Re: Is this a bug?

From
Phil Hord <phil.hord@gmail.com>
Date
Feb 22, 2013, 19:29 UTC
Message-ID
<CABURp0rO5zJywFN16=Sn20b2DAVA7XBs4EC4GxGbxftXqUS6gA@mail.gmail.com>
In-Reply-To
<CACsJy8DjatRbL=J-MZmQFnd+_7i-WwYHSnkY_ga++fx1R5Whmw@mail.gmail.com>
On Tue, Feb 19, 2013 at 6:02 AM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 25 quoted lines
> On Tue, Feb 19, 2013 at 4:47 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>> On Tue, Feb 19, 2013 at 10:32 AM, David Wade <DAWAD@statoil.com> wrote:
>>> Hi,
>>>
>>> I wrote a commit message beginning with a hash (#) character, like this: 'git commit -m "#ifdef ...." '
>>>
>>> Everything went okay when committing, but then I tried 'git commit -amend' and without editing the commit message I was told I had an empty commit message.
>>>
>>> Is this a problem with my text editor (vim 7.2) or git itself? (git version 1.7.2.2 under RedHat 5.8) Or something I'm not supposed to do ;-) ?
>>
>> The problem is that when doing interactive editing of messages (like
>> 'git commit --amend' does), git considers '#' as a comment-character.
>> You can disable this by using the --cleanup=verbatim switch (or some
>> other suiting cleanup-setting, see 'git help commit').
>
> Nobody is always conscious about the leading # in commit message to do
> that. I once edited a commit message and the auto-wrap feature put '#'
> at the beginning of the line. I saved and went on without noticing one
> line was lost until much later :( Perhaps we should change the comment
> signature a bit to reduce accidents, like only recognize '#' lines as
> comments after a special line like
>
> # this is not a comment
> ### START OF COMMENT ###
> # this is a comment

Or maybe --amend should imply --cleanup=whitespace. -- Phil

Previous: Duy NguyenNext: Junio C Hamano
Message 5 of 6 in “RE: Is this a bug?”
  1. David WadeFeb 19, 2013
  2. Andreas EricssonFeb 19, 2013
  3. Erik Faye-LundFeb 19, 2013
  4. Duy NguyenFeb 19, 2013
  5. Phil HordFeb 22, 2013
  6. Junio C HamanoFeb 22, 2013

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.