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

Re: [BUG] GIT_AUTHOR_NAME was checked before prepare_fallback got called (ps/stash-in-c)

From
Jeff King <peff@peff.net>
Date
Mar 6, 2019, 20:00 UTC
Message-ID
<20190306200049.GA23315@sigill.intra.peff.net>
In-Reply-To
<20190306195236.GA22872@dev-l>
On Wed, Mar 06, 2019 at 11:52:36AM -0800, Denton Liu wrote:
Show 19 quoted lines
> Hello all,
> 
> I've been on "jch" for my daily use and I noticed today that git stash
> isn't working. I managed to debug it down to "ps/stash-in-c".
> 
> To reproduce on git.git, it's simply the following:
> 
> 	echo // >>dir.c
> 	git stash
> 
> This gives me the following error:
> 
> 	$ git stash
> 	BUG: ident.c:511: GIT_AUTHOR_NAME was checked before prepare_fallback got called
> 	Aborted (core dumped)
> 
> I haven't read through the branch's code so I'm not too familiar with
> the changes but please let me know if you need any other information or
> if there's anything I can help with.

Yeah, it seems like the code from fd5a58477c (ident: add the ability to provide a "fallback identity", 2019-02-25) is over-eager:

  static void set_env_if(const char *key, const char *value, int *given, int bit)
  {
        if (*given & bit)
                BUG("%s was checked before prepare_fallback got called", key);
	...
  }
  void prepare_fallback_ident(const char *name, const char *email)
  {
        set_env_if("GIT_AUTHOR_NAME", name,
                   &author_ident_explicitly_given, IDENT_NAME_GIVEN);
	...
  }

If the ident comes from config, then those bits will be set already, even if nobody ever looked at $GIT_AUTHOR_NAME. I think that BUG() should actually just be a silent return.

-Peff
Previous: Denton LiuNext: Thomas Gummerer
Message 2 of 4 in “[BUG] GIT_AUTHOR_NAME was checked before prepare_fallback got called (ps/stash-in-c)”
  1. Denton LiuMar 6, 2019
  2. Jeff KingMar 6, 2019
  3. Thomas GummererMar 6, 2019
  4. Junio C HamanoMar 7, 2019

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.