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

Re: [PATCH 1/2] ident: check for useConfigOnly before auto-detection of name/email

From
Jeff King <peff@peff.net>
Date
Mar 31, 2016, 16:31 UTC
Message-ID
<20160331163156.GA1189@sigill.intra.peff.net>
In-Reply-To
<20160331150109.GA7235@zeno>
On Thu, Mar 31, 2016 at 06:01:09PM +0300, Marios Titas wrote:
Show 26 quoted lines
> On Thu, Mar 31, 2016 at 10:40:03AM -0400, Jeff King wrote:
> >On Wed, Mar 30, 2016 at 10:29:42PM +0300, Marios Titas wrote:
> >
> >>If user.useConfigOnly is set, it does not make sense to try to
> >>auto-detect the name and/or the email. So it's better to do the
> >>useConfigOnly checks first.
> >
> >It might be nice to explain how it is better here. I'd guess it is
> >because we may fail during xgetpwuid(), giving a message that is much
> >less informative?
> 
> Oops sorry, my bad, I should have included an example in the commit message.
> So with git 2.8.0, if you provide a name and set useConfigOnly to true in
> your ~/.gitconfig file, then if try to commit something in a new git repo,
> it will fail with the following message:
> 
>    *** Please tell me who you are.
>    Run
>      git config --global user.email "you@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: unable to auto-detect email address (got 'XXX@YYY.(none)')
> 
> (provided of course that auto-detection of email fails). This wrong, because
> auto-detection is disabled anyway.

Ah, right. We used to die in xgetpwuid, but now we just set default_name_is_bogus. So I think bumping the use_config_only check above the name_is_bogus check would be sufficient. Where you put it (above ident_default_name) is fine, though it would be a problem if we later lazily loaded the config in that function (I don't have any particular plans to do so, though).

-Peff
Previous: Marios TitasNext: Junio C Hamano
Message 9 of 10 in “ident: check for useConfigOnly before auto-detection of name/email”
  1. 1/2 ident: check for useConfigOnly before auto-detection of name/emailMarios Titas, Mar 30, 2016
  2. 2/2 ident: make the useConfigOnly error messages more informativeMarios Titas, Mar 30, 2016
  3. Junio C HamanoMar 30, 2016
  4. Marios TitasMar 30, 2016
  5. Junio C HamanoApr 1, 2016
  6. Junio C HamanoApr 12, 2016
  7. Jeff KingMar 31, 2016
  8. Marios TitasMar 31, 2016
  9. Jeff KingMar 31, 2016
  10. Junio C HamanoApr 1, 2016

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.