Git development
 help / color / mirror / Atom feed
From: Andreas Ericsson <ae@op5.se>
To: David Wade <DAWAD@statoil.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Is this a bug?
Date: Tue, 19 Feb 2013 10:42:59 +0100	[thread overview]
Message-ID: <51234923.7090807@op5.se> (raw)
In-Reply-To: <937BB05095F39E46B969256AA776205322B2CF15C7@ST-EXCL29.statoil.net>

On 02/19/2013 10:32 AM, David Wade 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
> ;-) ?
> 

Lines starting with a hash sign are considered comments by git commit.
If you fire it up without '-m' you'll see that git puts all its own
notes about the commit in commented-out lines.

While empty commit messages aren't really unacceptable by git's model,
they're considered "almost certainly user errors". I expect the -m
flag being present when running 'git commit' causes the check for empty
message to be skipped, which isn't the case when amending the commit.


Btw, when I write messages probably similar to the one you just did, I
tend to write:
  Use compat-layer __builtin_clz() #ifndef __GNUC__
precisely to avoid this issue. It also puts the imperative first,
which I find makes for smoother reading. Putting the condition first
screams for a comma and a slight stagger in reading flow, like so:
  Unless built with gcc, use compat-layer __builtin_clz()

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

  reply	other threads:[~2013-02-19  9:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-19  9:32 Is this a bug? David Wade
2013-02-19  9:42 ` Andreas Ericsson [this message]
2013-02-19  9:47 ` Erik Faye-Lund
2013-02-19 11:02   ` Duy Nguyen
2013-02-22 19:29     ` Phil Hord
2013-02-22 21:48       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51234923.7090807@op5.se \
    --to=ae@op5.se \
    --cc=DAWAD@statoil.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox