Re: [RFC PATCH] gitweb: Map names/emails with mailmap
To
Jeff King
Cc
Emma Brooks
git@vger.kernel.org
From
Junio C Hamano
See Also
Prev Ref 1
Date
2020-07-31 02:10:44 UTC
Jeff King <peff@peff.net> writes:

> On Thu, Jul 30, 2020 at 04:12:17AM +0000, Emma Brooks wrote:
>
>> Add an option to map names and emails to their canonical forms via a
>> .mailmap file. This is enabled by default, consistent with the behavior
>> of Git itself.
>
> I'm quite far from an expert in gitweb, but this seems like a good
> feature to have.
>
> Having a separate implementation to read and apply mailmaps makes me
> worried that it will behave slightly differently than the C code,
> especially around corner cases. Is it possible for us to ask git
> programs that are called by gitweb to do the conversion for us (e.g.,
> by passing "--use-mailmap" or using "%aE" and "%aN" formatters)?
> I won't be surprised if the answer is "no, we access commits using
> lower-level plumbing". But it's worth looking into, I think, if you
> didn't already.

I briefly looked at tweaking "rev-list --header" but because it ends
up calling pretty.c::pp_header() for obvious reasons since we are
doing as little processing as possible in CMIT_FMT_RAW format, we do
not get to pretty.c::pp_user_info() which is where the mailmap
conversion happens for the normal "log" output.

It is tempting to split pp_user_info() into two parts (i.e. the
first few lines up to where map_user() is optionally called, and the
remainder), so that the CMIT_FMT_RAW users can optionally ask for
mailmap to kick in, but I doubt that it is worth it, if the only
potential benefitter is gitweb (which I consider is purely
maintenance mode---I am surprised the world hasn't yet switched to
gitiles, cgit and others).