Re: [PATCH] commit: search author pattern against mailmap

2013-08-26 Thread Jeff King
On Sun, Aug 25, 2013 at 10:27:52PM -0700, Junio C Hamano wrote: I'm on the fence. It doesn't actually save that many lines of code, and I guess it's possible that somebody would want a custom mailmap in the future. Even though you can't do it right now, all it would take is exposing

Re: [PATCH] commit: search author pattern against mailmap

2013-08-25 Thread Antoine Pelisse
On Sun, Aug 25, 2013 at 7:16 AM, Junio C Hamano gits...@pobox.com wrote: Jeff King p...@peff.net writes: Do we need to clear_mailmap before returning to avoid a leak? Good question. What I queued yesterday seems to have a call to clear_mailmap(mailmap) before that return. Indeed, the version

[PATCH] commit: search author pattern against mailmap

2013-08-25 Thread Antoine Pelisse
git commit --author=$name sets the author to one whose name matches the given string from existing commits, when $name is not in the Name e-mail format. However, it does not honor the mailmap to use the canonical name for the author found this way. Fix it by telling the logic to find a matching

Re: [PATCH] commit: search author pattern against mailmap

2013-08-25 Thread Jeff King
On Sun, Aug 25, 2013 at 12:01:29PM +0200, Antoine Pelisse wrote: So I kept clear_mailmap() where you put it, but I think it could be moved right after get_revision(). That is because I think format_commit_message() will run another read_mailmap() with an heap-allocated string_list. Anyway,

Re: [PATCH] commit: search author pattern against mailmap

2013-08-25 Thread Jeff King
On Sun, Aug 25, 2013 at 03:37:24PM +0200, Antoine Pelisse wrote: So we would stop passing mailmap string_list along down to map_user(), and the mailmap file (or blob) would be read the first time it's needed, and stored in a static global variable in mailmap.c. I think I'm OK with that

Re: [PATCH] commit: search author pattern against mailmap

2013-08-25 Thread Antoine Pelisse
On Sun, Aug 25, 2013 at 6:51 PM, Jeff King p...@peff.net wrote: On Sun, Aug 25, 2013 at 03:37:24PM +0200, Antoine Pelisse wrote: So we would stop passing mailmap string_list along down to map_user(), and the mailmap file (or blob) would be read the first time it's needed, and stored in a

Re: [PATCH] commit: search author pattern against mailmap

2013-08-25 Thread Junio C Hamano
Jeff King p...@peff.net writes: Exactly. Sample (largely untested) patch is below if you want to use it as a starting point. There are probably a few additional cleanups on top (e.g., git log understands --mailmap, which should probably be centralized to handle_revision_opt). I'm on the

Re: [PATCH] commit: search author pattern against mailmap

2013-08-24 Thread Jeff King
On Sat, Aug 24, 2013 at 04:07:47PM +0200, Antoine Pelisse wrote: @@ -945,13 +947,16 @@ static const char *find_author_by_nickname(const char *name) av[++ac] = buf.buf; av[++ac] = NULL; setup_revisions(ac, av, revs, NULL); + revs.mailmap = mailmap; +

Re: [PATCH] commit: search author pattern against mailmap

2013-08-24 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Sat, Aug 24, 2013 at 04:07:47PM +0200, Antoine Pelisse wrote: @@ -945,13 +947,16 @@ static const char *find_author_by_nickname(const char *name) av[++ac] = buf.buf; av[++ac] = NULL; setup_revisions(ac, av, revs, NULL); +revs.mailmap =