Re: empty ident name trashes commit message
On Mon, Jul 23, 2012 at 01:27:26PM -0400, Jeff King wrote: > 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. It seems we already had such a check, but it was not done correctly. This is fixed by patch 2 below. > > 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. And patch 3 improves this situation. [1/3]: advice: pass varargs to strbuf_vaddf, not strbuf_addf [2/3]: commit: check committer identity more strictly [3/3]: commit: give a hint when a commit message has been abandoned -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: empty ident name trashes commit message
On Mon, Jul 23, 2012 at 6:27 PM, Jeff King wrote: > 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. Indeed. > 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. [...] > > 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 I agree, and thank you very much for those two useful pieces of information! (names stored in /etc/passwd and saving of .git/COMMIT_EDITMSG). -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: empty ident name trashes commit message
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 ) 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 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: empty ident name trashes commit message
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. Run git config --global user.email "y...@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: empty ident name (for ) not allowed 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. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html