git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Ramana Kumar <ramana@member.fsf.org>
Cc: git@vger.kernel.org
Subject: Re: empty ident name trashes commit message
Date: Mon, 23 Jul 2012 13:27:26 -0400	[thread overview]
Message-ID: <20120723172726.GA2463@sigill.intra.peff.net> (raw)
In-Reply-To: <CAMej=270FDFxyVtKTC9v4KUSkSw+TBNOg+LbGfWOgmTe_xKiRQ@mail.gmail.com>

On Sat, Jul 21, 2012 at 03:26:26PM +0100, Ramana Kumar wrote:

> If I forget to set user.email and user.name config options and do a commit
> (possibly the --amend option also required to make this show up), then git
> 1.7.11.2 will drops me into an editor for a commit message, then after that
> complain with the fatal message:
> 
>    *** Please tell me who you are.
> [...]

Hmm. I think this is an artifact of running --amend. In the normal case,
we check the author ident beforehand. But in the --amend case, we take
the existing author, but then fail trying to generate the committer
ident. So we could probably do better by checking both explicitly
beforehand.

>    fatal: empty ident name (for <ramana.kumar@gmail.com>) not allowed

Usually we would fall back to your name from /etc/passwd. I guess it is
blank on your system.

> The commit message I wrote is now lost. This is bad behaviour - the error
> should happen before one writes the commit message, or the message should be
> saved somewhere.

It's not lost. It's in .git/COMMIT_EDITMSG.

We could probably do a better job of informing the user of this when
commit dies prematurely.

-Peff

  reply	other threads:[~2012-07-23 17:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAMej=25=xj61pc+k42dv3byuBqUJzW21Sz+BXwoufqnKwV5Bbg@mail.gmail.com>
2012-07-21 14:26 ` empty ident name trashes commit message Ramana Kumar
2012-07-23 17:27   ` Jeff King [this message]
2012-07-23 18:05     ` Ramana Kumar
2012-07-23 18:46     ` Jeff King
2012-07-23 18:48       ` [PATCH 1/3] advice: pass varargs to strbuf_vaddf, not strbuf_addf Jeff King
2012-07-23 18:50       ` [PATCH 2/3] commit: check committer identity more strictly Jeff King
2012-07-23 20:51         ` Junio C Hamano
2012-07-23 20:53           ` Jeff King
2012-07-23 18:52       ` [PATCH 3/3] commit: give a hint when a commit message has been abandoned Jeff King
2012-07-23 20:49         ` Junio C Hamano
2012-07-23 20:52           ` Jeff King
2012-07-23 21:00             ` Junio C Hamano
2012-07-23 21:13               ` Jeff King
2012-07-23 21:35                 ` Junio C Hamano
2012-07-23 21:43                   ` Jeff King
2012-07-23 22:09                     ` 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=20120723172726.GA2463@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=ramana@member.fsf.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;
as well as URLs for NNTP newsgroup(s).