Thread (5 messages) flat view 5 messages, 5 authors, 2016-06-15

Re: Is this a bug?

From: Duy Nguyen <hidden>
Date: 2016-06-15 22:56:12

On Tue, Feb 19, 2013 at 4:47 PM, Erik Faye-Lund [off-list ref] wrote:
On Tue, Feb 19, 2013 at 10:32 AM, David Wade [off-list ref] wrote:
quoted
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
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help