[PATCH] commit: search author pattern against mailmap

2013-08-24 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 " 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 exis

[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 " 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 exis

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; > + read_

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

2013-08-24 Thread Junio C Hamano
Jeff King 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

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 wrote: > Jeff King 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 you queued has clear_ma

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 Antoine Pelisse
On Sun, Aug 25, 2013 at 12:30 PM, Jeff King wrote: > 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 re

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 bec

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 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 static glo

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

2013-08-25 Thread Junio C Hamano
Jeff King 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 fence.

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 > > exposin