{"thread":{"id":"32936","subject":"RE: Is this a bug?","startedAt":"2013-02-19T09:32:12Z","lastAt":"2013-02-22T21:48:46Z","messageCount":6,"participants":["David Wade","Andreas Ericsson","Erik Faye-Lund","Duy Nguyen","Phil Hord","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"209785","messageId":"937BB05095F39E46B969256AA776205322B2CF15C7@ST-EXCL29.statoil.net","threadId":"32936","inReplyTo":null,"subject":"RE: Is this a bug?","fromName":"David Wade","fromEmail":"dawad@statoil.com","sentAt":"2013-02-19T09:32:12Z","receivedAt":"2013-02-19T09:32:12Z","isPatch":false,"sender":{"key":"dawad@statoil.com","avatar":null},"body":"Hi,\n\nI wrote a commit message beginning with a hash (#) character, like this: 'git commit -m \"#ifdef ....\" '\n\nEverything 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.\n\nIs 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 ;-) ?\n\nThanks!\n\nDavid Wade\nAnalyst, Seismic Imaging Development\nITC SUB RES\nStatoil ASA\n\nMobile: +47 97572157\nEmail: dawad@statoil.com\n\nVisitor address: Vassbotnen 23, Forus, Norway\nIncorporation number: NO 923 609 016 MVA\nwww.statoil.com\nPlease consider the environment before printing this e-mail.\n\n\n-------------------------------------------------------------------\nThe information contained in this message may be CONFIDENTIAL and is\nintended for the addressee only. Any unauthorised use, dissemination of the\ninformation or copying of this message is prohibited. If you are not the\naddressee, please notify the sender immediately by return e-mail and delete\nthis message.\nThank you\n"},{"id":"209789","messageId":"51234923.7090807@op5.se","threadId":"32936","inReplyTo":"937BB05095F39E46B969256AA776205322B2CF15C7@ST-EXCL29.statoil.net","subject":"Re: Is this a bug?","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2013-02-19T09:42:59Z","receivedAt":"2013-02-19T09:42:59Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"On 02/19/2013 10:32 AM, David Wade wrote:\n> Hi,\n> \n> I wrote a commit message beginning with a hash (#) character, like\n> this: 'git commit -m \"#ifdef ....\" '\n> \n> Everything went okay when committing, but then I tried 'git commit\n> -amend' and without editing the commit message I was told I had an\n> empty commit message.\n> \n> Is this a problem with my text editor (vim 7.2) or git itself? (git\n> version 1.7.2.2 under RedHat 5.8) Or something I'm not supposed to do\n> ;-) ?\n> \n\nLines starting with a hash sign are considered comments by git commit.\nIf you fire it up without '-m' you'll see that git puts all its own\nnotes about the commit in commented-out lines.\n\nWhile empty commit messages aren't really unacceptable by git's model,\nthey're considered \"almost certainly user errors\". I expect the -m\nflag being present when running 'git commit' causes the check for empty\nmessage to be skipped, which isn't the case when amending the commit.\n\n\nBtw, when I write messages probably similar to the one you just did, I\ntend to write:\n  Use compat-layer __builtin_clz() #ifndef __GNUC__\nprecisely to avoid this issue. It also puts the imperative first,\nwhich I find makes for smoother reading. Putting the condition first\nscreams for a comma and a slight stagger in reading flow, like so:\n  Unless built with gcc, use compat-layer __builtin_clz()\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n\nConsidering the successes of the wars on alcohol, poverty, drugs and\nterror, I think we should give some serious thought to declaring war\non peace.\n"},{"id":"209790","messageId":"CABPQNSY4ordHh2ee8mk-2kCD40+sMf_SxrjfzGbkyGGTNW1TzA@mail.gmail.com","threadId":"32936","inReplyTo":"937BB05095F39E46B969256AA776205322B2CF15C7@ST-EXCL29.statoil.net","subject":"Re: Is this a bug?","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2013-02-19T09:47:53Z","receivedAt":"2013-02-19T09:47:53Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Tue, Feb 19, 2013 at 10:32 AM, David Wade <DAWAD@statoil.com> wrote:\n> Hi,\n>\n> I wrote a commit message beginning with a hash (#) character, like this: 'git commit -m \"#ifdef ....\" '\n>\n> 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.\n>\n> 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 ;-) ?\n\nThe problem is that when doing interactive editing of messages (like\n'git commit --amend' does), git considers '#' as a comment-character.\nYou can disable this by using the --cleanup=verbatim switch (or some\nother suiting cleanup-setting, see 'git help commit').\n"},{"id":"209807","messageId":"CACsJy8DjatRbL=J-MZmQFnd+_7i-WwYHSnkY_ga++fx1R5Whmw@mail.gmail.com","threadId":"32936","inReplyTo":"CABPQNSY4ordHh2ee8mk-2kCD40+sMf_SxrjfzGbkyGGTNW1TzA@mail.gmail.com","subject":"Re: Is this a bug?","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-02-19T11:02:12Z","receivedAt":"2013-02-19T11:02:12Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, Feb 19, 2013 at 4:47 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:\n> On Tue, Feb 19, 2013 at 10:32 AM, David Wade <DAWAD@statoil.com> wrote:\n>> Hi,\n>>\n>> I wrote a commit message beginning with a hash (#) character, like this: 'git commit -m \"#ifdef ....\" '\n>>\n>> 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.\n>>\n>> 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 ;-) ?\n>\n> The problem is that when doing interactive editing of messages (like\n> 'git commit --amend' does), git considers '#' as a comment-character.\n> You can disable this by using the --cleanup=verbatim switch (or some\n> other suiting cleanup-setting, see 'git help commit').\n\nNobody is always conscious about the leading # in commit message to do\nthat. I once edited a commit message and the auto-wrap feature put '#'\nat the beginning of the line. I saved and went on without noticing one\nline was lost until much later :( Perhaps we should change the comment\nsignature a bit to reduce accidents, like only recognize '#' lines as\ncomments after a special line like\n\n# this is not a comment\n### START OF COMMENT ###\n# this is a comment\n-- \nDuy\n"},{"id":"210051","messageId":"CABURp0rO5zJywFN16=Sn20b2DAVA7XBs4EC4GxGbxftXqUS6gA@mail.gmail.com","threadId":"32936","inReplyTo":"CACsJy8DjatRbL=J-MZmQFnd+_7i-WwYHSnkY_ga++fx1R5Whmw@mail.gmail.com","subject":"Re: Is this a bug?","fromName":"Phil Hord","fromEmail":"phil.hord@gmail.com","sentAt":"2013-02-22T19:29:47Z","receivedAt":"2013-02-22T19:29:47Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"On Tue, Feb 19, 2013 at 6:02 AM, Duy Nguyen <pclouds@gmail.com> wrote:\n> On Tue, Feb 19, 2013 at 4:47 PM, Erik Faye-Lund <kusmabite@gmail.com> wrote:\n>> On Tue, Feb 19, 2013 at 10:32 AM, David Wade <DAWAD@statoil.com> wrote:\n>>> Hi,\n>>>\n>>> I wrote a commit message beginning with a hash (#) character, like this: 'git commit -m \"#ifdef ....\" '\n>>>\n>>> 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.\n>>>\n>>> 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 ;-) ?\n>>\n>> The problem is that when doing interactive editing of messages (like\n>> 'git commit --amend' does), git considers '#' as a comment-character.\n>> You can disable this by using the --cleanup=verbatim switch (or some\n>> other suiting cleanup-setting, see 'git help commit').\n>\n> Nobody is always conscious about the leading # in commit message to do\n> that. I once edited a commit message and the auto-wrap feature put '#'\n> at the beginning of the line. I saved and went on without noticing one\n> line was lost until much later :( Perhaps we should change the comment\n> signature a bit to reduce accidents, like only recognize '#' lines as\n> comments after a special line like\n>\n> # this is not a comment\n> ### START OF COMMENT ###\n> # this is a comment\n\nOr maybe --amend should imply --cleanup=whitespace.\n--\nPhil\n"},{"id":"210059","messageId":"7vehg8c94x.fsf@alter.siamese.dyndns.org","threadId":"32936","inReplyTo":"CABURp0rO5zJywFN16=Sn20b2DAVA7XBs4EC4GxGbxftXqUS6gA@mail.gmail.com","subject":"Re: Is this a bug?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-22T21:48:46Z","receivedAt":"2013-02-22T21:48:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phil Hord <phil.hord@gmail.com> writes:\n\n> Or maybe --amend should imply --cleanup=whitespace.\n\nI am fairly negative on that.\n\nSuch a hidden linkage, even if it is documented, is just one more\nthing people need to learn.\n\nIt _might_ be interesting (note: I did not say \"worthwhile\" here) to\nthink what happens if we scanned the message (either coming from the\ncommit being amended, -F file option, or -m message option), picked\na punctuation character that does not appear at the beginning of the\nlines in it, and automatically adjusted core.commentchar if '#'\nappears at the beginning of one of the lines, though.\n"}]}