Re: [PATCH 4/3] am, sequencer: stop parsing our own committer ident
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Oct 26, 2020, 16:25 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2010261722230.56@tvgsbejvaqbjf.bet>
- In-Reply-To
- <20201023074510.GB2918369@coredump.intra.peff.net>
Hi Peff,
On Fri, 23 Oct 2020, Jeff King wrote:
Show 13 quoted lines
> diff --git a/ident.c b/ident.c
> index 6aba4b5cb6..7743c1ed05 100644
> --- a/ident.c
> +++ b/ident.c
> @@ -384,6 +384,12 @@ const char *fmt_ident(const char *name, const char *email,
> struct strbuf *ident = &ident_pool[index];
> index = (index + 1) % ARRAY_SIZE(ident_pool);
>
> + if (!email) {
> + if (whose_ident == WANT_AUTHOR_IDENT)
> + email = getenv("GIT_AUTHOR_EMAIL");
> + else if (whose_ident == WANT_COMMITTER_IDENT)
> + email = getenv("GIT_COMMITTER_EMAIL");I *guess* that this is a strict improvement, calling `getenv()` much closer to the time the value is actually used (and hence avoiding the problem where pointers returned by `getenv()` get stale due to environment changes).
Thanks, Dscho