Re: [PATCH 4/3] am, sequencer: stop parsing our own committer ident

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Peff,

On Fri, 23 Oct 2020, Jeff King wrote:

> 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux