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

Re: possible bug: inconsistent CLI behaviour for empty user.name

From
Jeff King <peff@peff.net>
Date
Feb 23, 2017, 08:11 UTC
Message-ID
<20170223081157.hwfn3msfux5udmng@sigill.intra.peff.net>
In-Reply-To
<20170203051309.a737846dd26a6ed8df1e4112@gmx.de>
On Fri, Feb 03, 2017 at 05:13:09AM +0100, bs.x.ttp@recursor.net wrote:
Show 5 quoted lines
> The problem is that GIT accepts a user.name of " " for some operations
> (for example when doing a simple "git commit"), but does require a
> "non-empty" user.name for others (like git commit --amend and git
> rebase). In case of the latter commands GIT fails with the message
> "fatal: empty ident name (for <email@address>) not allowed".

I think it's a bug. We try to always reject empty usernames, but the "empty" check is done before we cut off leading and trailing cruft (like whitespace).

The "--amend" command notices because it actually parses the name out of the existing commit. That version has already had its whitespace eaten up (when it was written into the original commit), and so it ends up as blank.

Here's a series which fixes that along with a few other oddities I noticed.

  [1/4]: ident: mark error messages for translation
  [2/4]: ident: handle NULL email when complaining of empty name
  [3/4]: ident: reject all-crud ident name
  [4/4]: ident: do not ignore empty config name/email
 ident.c                       | 49 ++++++++++++++++++++++++++-----------------
 t/t7518-ident-corner-cases.sh | 36 +++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 19 deletions(-)
 create mode 100755 t/t7518-ident-corner-cases.sh
-Peff
Previous: bs.x.ttp@recursor.netNext: Jeff King
Message 2 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.