Jeff King <> writes:

>> But for that old and established "--author parameter that does not
>> use the standard format guesses" feature to be useful, I agree that
>> it should honor the mailmap.
>> I wonder if it would hurt anybody if we made this unconditional, not
>> even with "--no-mailmap" override? Opinions?
> I think it would be OK. You can always override by giving the actual
> full address you want instead of a partial one.

OK, so how about labelling it as a bugfix, like this perhaps?  We
obviously need a test or two, though.

-- >8 --
From: Antoine Pelisse <>
Date: Fri, 23 Aug 2013 15:48:31 +0200
Subject: [PATCH] commit: search author pattern against mailmap

"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 existing author to
honor the mailmap, and use the name and email after applying the

Signed-off-by: Antoine Pelisse <>
Signed-off-by: Junio C Hamano <>
 builtin/commit.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 10acc53..5b7d969 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -30,6 +30,7 @@
 #include "column.h"
 #include "sequencer.h"
 #include "notes-utils.h"
+#include "mailmap.h"
 static const char * const builtin_commit_usage[] = {
        N_("git commit [options] [--] <pathspec>..."),
@@ -945,13 +946,16 @@ static const char *find_author_by_nickname(const char 
        av[++ac] = buf.buf;
        av[++ac] = NULL;
        setup_revisions(ac, av, &revs, NULL);
+       revs.mailmap = xcalloc(1, sizeof(struct string_list));
+       read_mailmap(revs.mailmap, NULL);
        commit = get_revision(&revs);
        if (commit) {
                struct pretty_print_context ctx = {0};
                ctx.date_mode = DATE_NORMAL;
-               format_commit_message(commit, "%an <%ae>", &buf, &ctx);
+               format_commit_message(commit, "%aN <%aE>", &buf, &ctx);
                return strbuf_detach(&buf, NULL);
        die(_("No existing author found with '%s'"), name);
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to