Re: GIT_COMMITTER_* and reflog
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 27, 2019, 12:20 UTC
- Message-ID
- <xmqqr22ybcs7.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20191026173702.GA5522@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> If somebody wants to pursue a patch, I suspect the solution is probably > something like this (totally untested):
Looks sensible. It is very much unsatisfying that datestamp(), which is used by fmt_ident() when no date string is given, seems to totally bypass date.c::get_time(), which means the framework to give fake timestamp via GIT_TEST_DATE_NOW cannot be used to write reproducible tests.
Given that datestamp() is only used by the push certificate and fast-import codepaths and nowhere else, I suspect that "fixing" it retroactively to honor GIT_TEST_DATE_NOW would not have any negative fallout, but that's not something I should be contemplating on during the -rc period ;-)
Thanks.
Show 19 quoted lines
>
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index d60767ab73..2ebf2feeb8 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -1658,7 +1658,10 @@ static int files_log_ref_write(struct files_ref_store *refs,
> if (logfd < 0)
> return 0;
> result = log_ref_write_fd(logfd, old_oid, new_oid,
> - git_committer_info(0), msg);
> + fmt_ident(getenv("GIT_COMMITTER_NAME"),
> + getenv("GIT_COMMITTER_EMAIL"),
> + WANT_COMMITTER_IDENT, NULL, 0),
> + msg);
> if (result) {
> struct strbuf sb = STRBUF_INIT;
> int save_errno = errno;
>
> -Peff