git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 4/4] ident: do not ignore empty config name/email

From
Jeff King <peff@peff.net>
Date
Feb 24, 2017, 01:08 UTC
Message-ID
<20170224010823.my4wmdyezjuqajfx@sigill.intra.peff.net>
In-Reply-To
<xmqqfuj47hfk.fsf@gitster.mtv.corp.google.com>
On Thu, Feb 23, 2017 at 12:58:39PM -0800, Junio C Hamano wrote:
Show 11 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > This one is perhaps questionable. Maybe somebody is relying on setting a
> > per-repo user.name to override a ~/.gitconfig value and enforce
> > auto-detection?
> 
> Thanks for splitting this step out.  1/4 and 2/4 are obvious
> improvements, and 3/4 is a very sensible fix.  Compared to those
> three, this one does smell questionable, because I do not quite see
> any other reasonable fallback other than the auto-detection if the
> user gives an empty ident on purpose.
The outcomes are basically:
  1. In strict mode (making a commit, etc), we'll die with "empty name
     not allowed". My thinking was that this is less confusing for the
     user.
  2. In non-strict mode, we'd use a blank name instead of trying your
     username (or dying if you don't have an /etc/passwd entry).
Show 7 quoted lines
> Erroring out to say "don't do that" is probably not too bad, but
> perhaps we are being run by a script that is doing a best-effort
> conversion from $ANOTHER_SCM using a list of known authors that is
> incomplete, ending up feeding empty ident and allowing us to fall
> back to attribute them to the user who runs the script.  I do not
> see a point in breaking that user and having her or him update the
> script to stuff in a truly bogus "Unknown <unknown>" name.

Keep in mind this _only_ affects Git's config variables. So a script feeding git via GIT_AUTHOR_NAME, etc, shouldn't change at all with this code. If your script is doing "git -c user.name=whatever commit", I think you should reconsider your script. :)

So I dunno. I could really go either way on it. Feel free to drop it, or even move it into a separate topic to be cooked longer.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 13 in “possible bug: inconsistent CLI behaviour for empty user.name”
  1. bs.x.ttp@recursor.netFeb 3, 2017
  2. Jeff KingFeb 23, 2017
  3. 2/4 ident: handle NULL email when complaining of empty nameJeff King, Feb 23, 2017
  4. 1/4 ident: mark error messages for translationJeff King, Feb 23, 2017
  5. 3/4 ident: reject all-crud ident nameJeff King, Feb 23, 2017
  6. 4/4 ident: do not ignore empty config name/emailJeff King, Feb 23, 2017
  7. Junio C HamanoFeb 23, 2017
  8. Jeff KingFeb 24, 2017
  9. Junio C HamanoFeb 24, 2017
  10. Jeff KingFeb 24, 2017
  11. Dennis KaarsemakerFeb 27, 2017
  12. Junio C HamanoFeb 27, 2017
  13. Christian CouderFeb 28, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.