git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Denton Liu <liu.denton@gmail.com>
Cc: git@vger.kernel.org, johannes.schindelin@gmx.de,
	t.gummerer@gmail.com, gitster@pobox.com
Subject: Re: [BUG] GIT_AUTHOR_NAME was checked before prepare_fallback got called (ps/stash-in-c)
Date: Wed, 6 Mar 2019 15:00:49 -0500	[thread overview]
Message-ID: <20190306200049.GA23315@sigill.intra.peff.net> (raw)
In-Reply-To: <20190306195236.GA22872@dev-l>

On Wed, Mar 06, 2019 at 11:52:36AM -0800, Denton Liu wrote:

> 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

  reply	other threads:[~2019-03-06 20:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-06 19:52 [BUG] GIT_AUTHOR_NAME was checked before prepare_fallback got called (ps/stash-in-c) Denton Liu
2019-03-06 20:00 ` Jeff King [this message]
2019-03-06 22:09   ` Thomas Gummerer
2019-03-07  0:40     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190306200049.GA23315@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=liu.denton@gmail.com \
    --cc=t.gummerer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).