{"thread":{"id":"17491","subject":"[PATCH v2 2/4] Add find_insert_index, insert_at_index and clear_func functions to string_list","startedAt":"2009-02-01T20:59:55Z","lastAt":"2009-02-02T08:40:05Z","messageCount":15,"participants":["Marius Storm-Olsen","Junio C Hamano","Sverre Rabbelier"],"isPatch":true,"patchVersion":2,"patchTotal":4},"messages":[{"id":"102776","messageId":"cover.1233520945.git.marius@trolltech.com","threadId":"17491","inReplyTo":null,"subject":"[PATCH v2 0/4] Extend mailmap functionality","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2009-02-01T20:59:55Z","receivedAt":"2009-02-01T20:59:55Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"  v2: changes since v1\n  --------------------\n  * Folded in documentation fixup from patch 4 into patch 3.\n\n\nThis patch series extends the mailmap functionality to:\n  1) Allow the mailmap file in any location (also outside repo)\n  2) Enable mailmap to match on both Name and Email\n\nSo, why would this be a good thing?\n\n2) Lets you replace both name and email of an author/committer, based\non a name and/or email. So, should you have done commits with faulty\naddress, or if an old email simply isn't valid anymore, you can add\na mapping for that to replace it. So, the old style mapping is\n    Proper Name <commit@email.xx>\n\nwhile this patch series adds support for\n    Proper Name <proper@email.xx> <commit@email.xx>\n    Proper Name <proper@email.xx> Commit Name <commit@email.xx>\n\n1) Lets you keep a private mailmap file, which is not distributed with\nyour repository.\n\n\nThis extended mapping is necessary when a company wants to have their\nrepositories open to the public, but needs to protect the identities\nof the developers. It enables you to only show nicks and standardized\nemails, like 'Dev123 <bugs@company.xx>' in the public repo, but by\nusing an private mailmap file, map the name back to\n'John Doe <john.doe@company.xx>' inside the company.\n\n\nPatch serie applies cleanly on master branch, and test run shows no\nregressions.\n\nMarius Storm-Olsen (4):\n  Add log.mailmap as configurational option for mailmap location\n  Add find_insert_index, insert_at_index and clear_func functions to\n    string_list\n  Add map_user() and clear_mailmap() to mailmap\n  Change current mailmap usage to do matching on both name and email of\n    author/committer.\n\n Documentation/config.txt         |    9 ++\n Documentation/git-shortlog.txt   |   61 +++++++++---\n Documentation/pretty-formats.txt |    2 +\n builtin-blame.c                  |   52 ++++++----\n builtin-shortlog.c               |   25 ++++-\n cache.h                          |    1 +\n config.c                         |   10 ++\n mailmap.c                        |  207 ++++++++++++++++++++++++++++++++++----\n mailmap.h                        |    4 +\n pretty.c                         |   59 ++++++-----\n string-list.c                    |   43 +++++++-\n string-list.h                    |    9 ++\n t/t4203-mailmap.sh               |  152 ++++++++++++++++++++++++++++\n 13 files changed, 541 insertions(+), 93 deletions(-)\n create mode 100755 t/t4203-mailmap.sh\n"},{"id":"102777","messageId":"ce94ea88e3182e97997c23f71e184e0db64fa708.1233520945.git.marius@trolltech.com","threadId":"17491","inReplyTo":"cover.1233520945.git.marius@trolltech.com","subject":"[PATCH v2 1/4] Add log.mailmap as configurational option for mailmap location","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2009-02-01T20:59:56Z","receivedAt":"2009-02-01T20:59:56Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"This allows us to override a repo mailmap file, or to use\nmailmap files elsewhere than the repository root.\n\nShould the log.mailmap file not be found, it falls back to \".mailmap\".\n\nSigned-off-by: Marius Storm-Olsen <marius@trolltech.com>\n---\n Documentation/config.txt       |    9 +++++++\n Documentation/git-shortlog.txt |    3 +-\n builtin-blame.c                |    2 +-\n builtin-shortlog.c             |    3 +-\n cache.h                        |    1 +\n config.c                       |   10 +++++++\n mailmap.c                      |    9 ++++++-\n t/t4203-mailmap.sh             |   53 ++++++++++++++++++++++++++++++++++++++++\n 8 files changed, 86 insertions(+), 4 deletions(-)\n create mode 100755 t/t4203-mailmap.sh\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex e2b8775..02c7b4c 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1012,6 +1012,15 @@ log.showroot::\n \tTools like linkgit:git-log[1] or linkgit:git-whatchanged[1], which\n \tnormally hide the root commit will now show it. True by default.\n \n+log.mailmap::\n+\tOverrides the default location of the mailmap file. The default\n+\tmailmap location is .mailmap in the root of the repository.\n+\tThe new location of the mailmap file may be in a repository\n+\tsubdirectory, or somewhere outside of the repository itself.\n+\tIf git can't find the file, it will try to load the default\n+\tmailmap location instead.\n+\tSee linkgit:git-shortlog[1] and linkgit:git-blame[1].\n+\n man.viewer::\n \tSpecify the programs that may be used to display help in the\n \t'man' format. See linkgit:git-help[1].\ndiff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt\nindex 8f7c0e2..cacbeea 100644\n--- a/Documentation/git-shortlog.txt\n+++ b/Documentation/git-shortlog.txt\n@@ -48,7 +48,8 @@ OPTIONS\n FILES\n -----\n \n-If a file `.mailmap` exists at the toplevel of the repository,\n+If a file `.mailmap` exists at the toplevel of the repository, or at the\n+location pointed to by the log.mailmap configuration option,\n it is used to map an author email address to a canonical real name. This\n can be used to coalesce together commits by the same person where their\n name was spelled differently (whether with the same email address or\ndiff --git a/builtin-blame.c b/builtin-blame.c\nindex aae14ef..4b63775 100644\n--- a/builtin-blame.c\n+++ b/builtin-blame.c\n@@ -2394,7 +2394,7 @@ parse_done:\n \t\tdie(\"reading graft file %s failed: %s\",\n \t\t    revs_file, strerror(errno));\n \n-\tread_mailmap(&mailmap, \".mailmap\", NULL);\n+\tread_mailmap(&mailmap, NULL, NULL);\n \n \tif (!incremental)\n \t\tsetup_pager();\ndiff --git a/builtin-shortlog.c b/builtin-shortlog.c\nindex 5f9f3f0..04832a8 100644\n--- a/builtin-shortlog.c\n+++ b/builtin-shortlog.c\n@@ -219,7 +219,7 @@ void shortlog_init(struct shortlog *log)\n {\n \tmemset(log, 0, sizeof(*log));\n \n-\tread_mailmap(&log->mailmap, \".mailmap\", &log->common_repo_prefix);\n+\tread_mailmap(&log->mailmap, NULL, &log->common_repo_prefix);\n \n \tlog->list.strdup_strings = 1;\n \tlog->wrap = DEFAULT_WRAPLEN;\n@@ -248,6 +248,7 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)\n \tstruct parse_opt_ctx_t ctx;\n \n \tprefix = setup_git_directory_gently(&nongit);\n+\tgit_config(git_default_config, NULL);\n \tshortlog_init(&log);\n \tinit_revisions(&rev, prefix);\n \tparse_options_start(&ctx, argc, argv, PARSE_OPT_KEEP_DASHDASH |\ndiff --git a/cache.h b/cache.h\nindex 45e713e..3eef7ea 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -867,6 +867,7 @@ extern int user_ident_explicitly_given;\n \n extern const char *git_commit_encoding;\n extern const char *git_log_output_encoding;\n+extern const char *git_log_mailmap;\n \n /* IO helper functions */\n extern void maybe_flush_or_die(FILE *, const char *);\ndiff --git a/config.c b/config.c\nindex 790405a..9ebcbbe 100644\n--- a/config.c\n+++ b/config.c\n@@ -565,6 +565,13 @@ static int git_default_branch_config(const char *var, const char *value)\n \treturn 0;\n }\n \n+static int git_default_log_config(const char *var, const char *value)\n+{\n+\tif (!strcmp(var, \"log.mailmap\"))\n+\t\treturn git_config_string(&git_log_mailmap, var, value);\n+\treturn 0;\n+}\n+\n int git_default_config(const char *var, const char *value, void *dummy)\n {\n \tif (!prefixcmp(var, \"core.\"))\n@@ -579,6 +586,9 @@ int git_default_config(const char *var, const char *value, void *dummy)\n \tif (!prefixcmp(var, \"branch.\"))\n \t\treturn git_default_branch_config(var, value);\n \n+\tif (!prefixcmp(var, \"log.\"))\n+\t\treturn git_default_log_config(var, value);\n+\n \tif (!strcmp(var, \"pager.color\") || !strcmp(var, \"color.pager\")) {\n \t\tpager_use_color = git_config_bool(var,value);\n \t\treturn 0;\ndiff --git a/mailmap.c b/mailmap.c\nindex 88fc6f3..32eab6c 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -2,11 +2,18 @@\n #include \"string-list.h\"\n #include \"mailmap.h\"\n \n+const char *git_log_mailmap;\n int read_mailmap(struct string_list *map, const char *filename, char **repo_abbrev)\n {\n \tchar buffer[1024];\n-\tFILE *f = fopen(filename, \"r\");\n+\tFILE *f = NULL;\n \n+\tif (filename)\n+\t\tf = fopen(filename, \"r\");\n+\tif (f == NULL && git_log_mailmap)\n+\t\tf = fopen(git_log_mailmap, \"r\");\n+\tif (f == NULL)\n+\t\tf = fopen(\".mailmap\", \"r\");\n \tif (f == NULL)\n \t\treturn 1;\n \twhile (fgets(buffer, sizeof(buffer), f) != NULL) {\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nnew file mode 100755\nindex 0000000..57fd88e\n--- /dev/null\n+++ b/t/t4203-mailmap.sh\n@@ -0,0 +1,53 @@\n+#!/bin/sh\n+\n+test_description='.mailmap configurations'\n+\n+. ./test-lib.sh\n+\n+test_expect_success setup '\n+\techo one >one &&\n+\tgit add one &&\n+\ttest_tick &&\n+\tgit commit -m initial\n+'\n+\n+test_expect_success 'No mailmap' '\n+\tgit shortlog >actual &&\n+\techo \"A U Thor (1):\" >expect; echo \"      initial\" >>expect; echo >>expect &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'default .mailmap' '\n+\techo \"Repo Guy <author@example.com>\" > .mailmap &&\n+\tgit shortlog >actual &&\n+\techo \"Repo Guy (1):\" >expect; echo \"      initial\" >>expect; echo >>expect &&\n+\ttest_cmp expect actual\n+'\n+\n+# Using a mailmap file in a subdirectory of the repo here, but\n+# could just as well have been a file outside of the repository\n+test_expect_success 'log.mailmap set' '\n+\tmkdir internal_mailmap &&\n+\techo \"Internal Guy <author@example.com>\" > internal_mailmap/.mailmap &&\n+\tgit config log.mailmap internal_mailmap/.mailmap &&\n+\tgit shortlog >actual &&\n+\techo \"Internal Guy (1):\" >expect; echo \"      initial\" >>expect; echo >>expect &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'log.mailmap file non-existant' '\n+\trm internal_mailmap/.mailmap &&\n+\trmdir internal_mailmap &&\n+\tgit shortlog >actual &&\n+\techo \"Repo Guy (1):\" >expect; echo \"      initial\" >>expect; echo >>expect &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'No mailmap files, but configured' '\n+\trm .mailmap &&\n+\tgit shortlog >actual &&\n+\techo \"A U Thor (1):\" >expect; echo \"      initial\" >>expect; echo >>expect &&\n+\ttest_cmp expect actual\n+'\n+\n+test_done\n-- \n1.6.1.2.257.g34f62\n"},{"id":"102775","messageId":"75a7d437c1b32600c509bdef5010e6ac30b6cb08.1233520945.git.marius@trolltech.com","threadId":"17491","inReplyTo":"ce94ea88e3182e97997c23f71e184e0db64fa708.1233520945.git.marius@trolltech.com","subject":"[PATCH v2 2/4] Add find_insert_index, insert_at_index and clear_func functions to string_list","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2009-02-01T20:59:57Z","receivedAt":"2009-02-01T20:59:57Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"string_list_find_insert_index() and string_list_insert_at_index() enables you to see if an item is in the string_list, and to insert at the appropriate index in the list, if not there.\nThis is usefull if you need to manipulate an existing item, if present, and insert a new item if not.\n\nFuture mailmap code will use this construct to enable complex (old_name, old_email) -> (new_name, new_email) lookups.\n\nThe string_list_clear_func() allows to call a custom cleanup function on each item in a string_list, which is useful is the util member points to a complex structure.\n\nSigned-off-by: Marius Storm-Olsen <marius@trolltech.com>\n---\n string-list.c |   43 +++++++++++++++++++++++++++++++++++++++----\n string-list.h |    9 +++++++++\n 2 files changed, 48 insertions(+), 4 deletions(-)\n\ndiff --git a/string-list.c b/string-list.c\nindex ddd83c8..15e14cf 100644\n--- a/string-list.c\n+++ b/string-list.c\n@@ -26,10 +26,10 @@ static int get_entry_index(const struct string_list *list, const char *string,\n }\n \n /* returns -1-index if already exists */\n-static int add_entry(struct string_list *list, const char *string)\n+static int add_entry(int insert_at, struct string_list *list, const char *string)\n {\n-\tint exact_match;\n-\tint index = get_entry_index(list, string, &exact_match);\n+\tint exact_match = 0;\n+\tint index = insert_at != -1 ? insert_at : get_entry_index(list, string, &exact_match);\n \n \tif (exact_match)\n \t\treturn -1 - index;\n@@ -53,7 +53,13 @@ static int add_entry(struct string_list *list, const char *string)\n \n struct string_list_item *string_list_insert(const char *string, struct string_list *list)\n {\n-\tint index = add_entry(list, string);\n+\treturn string_list_insert_at_index(-1, string, list);\n+}\n+\n+struct string_list_item *string_list_insert_at_index(int insert_at,\n+\t\t\t\t\t\t     const char *string, struct string_list *list)\n+{\n+\tint index = add_entry(insert_at, list, string);\n \n \tif (index < 0)\n \t\tindex = -1 - index;\n@@ -68,6 +74,16 @@ int string_list_has_string(const struct string_list *list, const char *string)\n \treturn exact_match;\n }\n \n+int string_list_find_insert_index(const struct string_list *list, const char *string,\n+\t\t\t\t  int negative_existing_index)\n+{\n+\tint exact_match;\n+\tint index = get_entry_index(list, string, &exact_match);\n+\tif (exact_match)\n+\t\tindex = -1 - (negative_existing_index ? index : 0);\n+\treturn index;\n+}\n+\n struct string_list_item *string_list_lookup(const char *string, struct string_list *list)\n {\n \tint exact_match, i = get_entry_index(list, string, &exact_match);\n@@ -94,6 +110,25 @@ void string_list_clear(struct string_list *list, int free_util)\n \tlist->nr = list->alloc = 0;\n }\n \n+void string_list_clear_func(struct string_list *list, string_list_clear_func_t clearfunc)\n+{\n+\tif (list->items) {\n+\t\tint i;\n+\t\tif (clearfunc) {\n+\t\t\tfor (i = 0; i < list->nr; i++)\n+\t\t\t\tclearfunc(list->items[i].util, list->items[i].string);\n+\t\t}\n+\t\tif (list->strdup_strings) {\n+\t\t\tfor (i = 0; i < list->nr; i++)\n+\t\t\t\tfree(list->items[i].string);\n+\t\t}\n+\t\tfree(list->items);\n+\t}\n+\tlist->items = NULL;\n+\tlist->nr = list->alloc = 0;\n+}\n+\n+\n void print_string_list(const char *text, const struct string_list *p)\n {\n \tint i;\ndiff --git a/string-list.h b/string-list.h\nindex 4d6a705..d32ba05 100644\n--- a/string-list.h\n+++ b/string-list.h\n@@ -15,9 +15,18 @@ struct string_list\n void print_string_list(const char *text, const struct string_list *p);\n void string_list_clear(struct string_list *list, int free_util);\n \n+/* Use this function to call a custom clear function on each util pointer */\n+/* The string associated with the util pointer is passed as the second argument */\n+typedef void (*string_list_clear_func_t)(void *p, const char *str);\n+void string_list_clear_func(struct string_list *list, string_list_clear_func_t clearfunc);\n+\n /* Use these functions only on sorted lists: */\n int string_list_has_string(const struct string_list *list, const char *string);\n+int string_list_find_insert_index(const struct string_list *list, const char *string,\n+\t\t\t\t  int negative_existing_index);\n struct string_list_item *string_list_insert(const char *string, struct string_list *list);\n+struct string_list_item *string_list_insert_at_index(int insert_at,\n+\t\t\t\t\t\t     const char *string, struct string_list *list);\n struct string_list_item *string_list_lookup(const char *string, struct string_list *list);\n \n /* Use these functions only on unsorted lists: */\n-- \n1.6.1.2.257.g34f62\n"},{"id":"102779","messageId":"0f360e115bde662b5297e803d8829b79c573ad58.1233520945.git.marius@trolltech.com","threadId":"17491","inReplyTo":"75a7d437c1b32600c509bdef5010e6ac30b6cb08.1233520945.git.marius@trolltech.com","subject":"[PATCH v2 3/4] Add map_user() and clear_mailmap() to mailmap","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2009-02-01T20:59:58Z","receivedAt":"2009-02-01T20:59:58Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"map_user() allows to lookup and replace both email and name of a user, based on a new style mailmap file.\nThe possible mailmap definitions now are:\n  proper_name <commit_email>                             // Old style\n  proper_name <proper_email> <commit_email>              // New style\n  proper_name <proper_email> commit_name <commit_email>  // New style\n\nmap_email() operates the same as before, with the exception that it also will to try to match on a name passed in through the name return buffer.\n\nclear_mailmap() is needed to now clear the more complex mailmap structure.\n\nSigned-off-by: Marius Storm-Olsen <marius@trolltech.com>\n---\n Documentation/git-shortlog.txt |   58 +++++++++---\n mailmap.c                      |  198 ++++++++++++++++++++++++++++++++++++----\n mailmap.h                      |    4 +\n 3 files changed, 227 insertions(+), 33 deletions(-)\n\ndiff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt\nindex cacbeea..d64dabf 100644\n--- a/Documentation/git-shortlog.txt\n+++ b/Documentation/git-shortlog.txt\n@@ -50,20 +50,29 @@ FILES\n \n If a file `.mailmap` exists at the toplevel of the repository, or at the\n location pointed to by the log.mailmap configuration option,\n-it is used to map an author email address to a canonical real name. This\n-can be used to coalesce together commits by the same person where their\n-name was spelled differently (whether with the same email address or\n-not).\n-\n-Each line in the file consists, in this order, of the canonical real name\n-of an author, whitespace, and an email address (enclosed by '<' and '>')\n-to map to the name. Use hash '#' for comments, either on their own line,\n-or after the email address.\n-\n-A canonical name may appear in more than one line, associated with\n-different email addresses, but it doesn't make sense for a given address\n-to appear more than once (if that happens, a later line overrides the\n-earlier ones).\n+it is used to map author and committer names and email addresses to\n+canonical real names and email addresses.\n+This can be used to coalesce together commits by the same person where\n+their name and/or email address was spelled differently.\n+\n+In the simple form, each line in the file consists of the canonical real name\n+of an author, whitespace, and an email address used in the commit\n+(enclosed by '<' and '>') to map to the name. Thus, looks like this\n+--\n+\tProper Name <commit@email.xx>\n+--\n+\n+The more complex forms are\n+--\n+\tProper Name <proper@email.xx> <commit@email.xx>\n+--\n+which allows mailmap to replace both the name and the email of a commit\n+matching the specified commit email address. And\n+--\n+\tProper Name <proper@email.xx> Commit Name <commit@email.xx>\n+--\n+which allows mailmap to replace both the name and the email of a commit\n+matching the specified commit name and email address.\n \n So, for example, if your history contains commits by two authors, Jane\n and Joe, whose names appear in the repository under several forms:\n@@ -86,6 +95,27 @@ Jane Doe <jane@desktop.(none)>\n Joe R. Developer <joe@random.com>\n ------------\n \n+Now, suppose your repository contains commits from the following authors:\n+\n+------------\n+nick1 <bugs@company.xx>\n+nick2 <bugs@company.xx>\n+nick2 <nick2@company.xx>\n+santa <me@company.xx>\n+claus <me@company.xx>\n+------------\n+\n+Then, you might want a `.mailmap` file looking like:\n+------------\n+Some Dude <some@dude.xx>         nick1 <bugs@company.xx>\n+Other Author <other@author.xx>   nick2 <bugs@company.xx>\n+Other Author <other@author.xx>         <nick2@company.xx>\n+Santa Claus <santa.claus@northpole.xx> <me@company.xx>\n+------------\n+\n+Use hash '#' for comments, either on their own line, or after the email address.\n+\n+\n Author\n ------\n Written by Jeff Garzik <jgarzik@pobox.com>\ndiff --git a/mailmap.c b/mailmap.c\nindex 32eab6c..937aa07 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -2,7 +2,87 @@\n #include \"string-list.h\"\n #include \"mailmap.h\"\n \n+#define DEBUG_MAILMAP 0\n+#if DEBUG_MAILMAP\n+#define debug_mm(...) fprintf(stderr, __VA_ARGS__)\n+#else\n+inline void debug_mm(const char *format, ...) {}\n+#endif\n+\n const char *git_log_mailmap;\n+\n+struct mailmap_info {\n+\tchar *name;\n+\tchar *email;\n+};\n+\n+struct mailmap_entry {\n+\t/* name and email for the simple mail-only case */\n+\tchar *name;\n+\tchar *email;\n+\n+\t/* name and email for the complex mail and name matching case */\n+\tstruct string_list namemap;\n+};\n+\n+void free_mailmap_info(void *p, const char *s)\n+{\n+\tstruct mailmap_info *mi = (struct mailmap_info *)p;\n+\tdebug_mm(\"mailmap: -- complex: '%s' -> '%s' <%s>\\n\", s, mi->name, mi->email);\n+\tfree(mi->name);\n+\tfree(mi->email);\n+}\n+\n+void free_mailmap_entry(void *p, const char *s)\n+{\n+\tstruct mailmap_entry *me = (struct mailmap_entry *)p;\n+\tdebug_mm(\"mailmap: removing entries for <%s>, with %d sub-entries\\n\", s, me->namemap.nr);\n+\tdebug_mm(\"mailmap: - simple: '%s' <%s>\\n\", me->name, me->email);\n+\tfree(me->name);\n+\tfree(me->email);\n+\n+\tme->namemap.strdup_strings = 1;\n+\tstring_list_clear_func(&me->namemap, free_mailmap_info);\n+}\n+\n+void add_mapping(struct string_list *map,\n+\t\t char *name1, char *email1, char *name2, char *email2)\n+{\n+\tstruct mailmap_entry *me;\n+\tint index = string_list_find_insert_index(map, email1, 1);\n+\tif (index < 0) {\n+\t\t/* mailmap entry exists, invert index value */\n+\t\tindex = -1 - index;\n+\t} else {\n+\t\t/* create mailmap entry */\n+\t\tstruct string_list_item *item = string_list_insert_at_index(index, email1, map);\n+\t\titem->util = xmalloc(sizeof(struct mailmap_entry));\n+\t\tmemset(item->util, 0, sizeof(struct mailmap_entry));\n+\t}\n+\tme = (struct mailmap_entry *)map->items[index].util;\n+\n+\tif (name2 == NULL) {\n+\t\tdebug_mm(\"mailmap: adding (simple) entry for %s at index %d\\n\", email1, index);\n+\t\t/* Replace current name and new email for simple entry */\n+\t\tfree(me->name);\n+\t\tfree(me->email);\n+\t\tme->name = xstrdup(name1);\n+\t\tif (email2)\n+\t\t\tme->email = xstrdup(email2);\n+\t} else {\n+\t\tstruct mailmap_info *mi = xmalloc(sizeof(struct mailmap_info));\n+\t\tdebug_mm(\"mailmap: adding (complex) entry for %s at index %d\\n\", email1, index);\n+\t\tmi->name = xstrdup(name2);\n+\t\tif (email2)\n+\t\t\tmi->email = xstrdup(email2);\n+\t\tstring_list_insert(name1, &me->namemap)->util = mi;\n+\t}\n+\n+\tdebug_mm(\"mailmap:  '%s' <%s> -> '%s' <%s>\\n\",\n+\t\t name2 ? name1 : \"\", email1,\n+\t\t name2 ? name2 : name1, email2 ? email2 : \"\");\n+}\n+\n int read_mailmap(struct string_list *map, const char *filename, char **repo_abbrev)\n {\n \tchar buffer[1024];\n@@ -17,8 +97,8 @@ int read_mailmap(struct string_list *map, const char *filename, char **repo_abbr\n \tif (f == NULL)\n \t\treturn 1;\n \twhile (fgets(buffer, sizeof(buffer), f) != NULL) {\n-\t\tchar *end_of_name, *left_bracket, *right_bracket;\n-\t\tchar *name, *email;\n+\t\tchar *end_of_name, *left_bracket1, *right_bracket1, *left_bracket2, *right_bracket2;\n+\t\tchar *name1, *email1, *name2, *email2;\n \t\tint i;\n \t\tif (buffer[0] == '#') {\n \t\t\tstatic const char abbrev[] = \"# repo-abbrev:\";\n@@ -43,41 +123,95 @@ int read_mailmap(struct string_list *map, const char *filename, char **repo_abbr\n \t\t\t}\n \t\t\tcontinue;\n \t\t}\n-\t\tif ((left_bracket = strchr(buffer, '<')) == NULL)\n+\t\t/* Locate name and email */\n+\t\tif ((left_bracket1 = strchr(buffer, '<')) == NULL)\n \t\t\tcontinue;\n-\t\tif ((right_bracket = strchr(left_bracket + 1, '>')) == NULL)\n+\t\tif ((right_bracket1 = strchr(left_bracket1 + 1, '>')) == NULL)\n \t\t\tcontinue;\n-\t\tif (right_bracket == left_bracket + 1)\n+\t\tif (right_bracket1 == left_bracket1 + 1)\n \t\t\tcontinue;\n-\t\tfor (end_of_name = left_bracket;\n+\t\tfor (end_of_name = left_bracket1;\n \t\t     end_of_name != buffer && isspace(end_of_name[-1]);\n \t\t     end_of_name--)\n \t\t\t; /* keep on looking */\n \t\tif (end_of_name == buffer)\n \t\t\tcontinue;\n-\t\tname = xmalloc(end_of_name - buffer + 1);\n-\t\tstrlcpy(name, buffer, end_of_name - buffer + 1);\n-\t\temail = xmalloc(right_bracket - left_bracket);\n-\t\tfor (i = 0; i < right_bracket - left_bracket - 1; i++)\n-\t\t\temail[i] = tolower(left_bracket[i + 1]);\n-\t\temail[right_bracket - left_bracket - 1] = '\\0';\n-\t\tstring_list_insert(email, map)->util = name;\n+\t\tname1 = xmalloc(end_of_name - buffer + 1);\n+\t\tstrlcpy(name1, buffer, end_of_name - buffer + 1);\n+\t\temail1 = xmalloc(right_bracket1 - left_bracket1);\n+\t\tfor (i = 0; i < right_bracket1 - left_bracket1 - 1; i++)\n+\t\t\temail1[i] = tolower(left_bracket1[i + 1]);\n+\t\temail1[right_bracket1 - left_bracket1 - 1] = '\\0';\n+\n+\t\t/* Locate 2nd name and email. Possible mappings in mailmap file are:\n+\t\t *   proper_name <commit_email>\n+\t\t *   proper_name <proper_email> <commit_email>\n+\t\t *   proper_name <proper_email> commit_name <commit_email>\n+\t\t */\n+\t\tdo {\n+\t\t\temail2 = name2 = 0;\n+\t\t\tright_bracket1 += 1;\n+\t\t\tif ((left_bracket2 = strchr(right_bracket1, '<')) == NULL)\n+\t\t\t\tcontinue;\n+\t\t\tif ((right_bracket2 = strchr(left_bracket2 + 1, '>')) == NULL)\n+\t\t\t\tcontinue;\n+\t\t\tif (right_bracket2 == left_bracket2 + 1)\n+\t\t\t\tcontinue;\n+\t\t\tfor (end_of_name = left_bracket2;\n+\t\t\t     end_of_name != right_bracket1 && isspace(end_of_name[-1]);\n+\t\t\t     end_of_name--)\n+\t\t\t\t; /* keep on looking for name end */\n+\t\t\tfor (;\n+\t\t\t     end_of_name != right_bracket1 && isspace(right_bracket1[0]);\n+\t\t\t     right_bracket1++)\n+\t\t\t\t; /* keep on looking for name start */\n+\t\t\tif (end_of_name != right_bracket1) {\n+\t\t\t\tname2 = xmalloc(end_of_name - right_bracket1 + 1);\n+\t\t\t\tstrlcpy(name2, right_bracket1, end_of_name - right_bracket1 + 1);\n+\t\t\t\tchar *tmp = name1;\n+\t\t\t\tname1 = name2;\n+\t\t\t\tname2 = tmp;\n+\t\t\t}\n+\t\t\temail2 = xmalloc(right_bracket2 - left_bracket2);\n+\t\t\tfor (i = 0; i < right_bracket2 - left_bracket2 - 1; i++)\n+\t\t\t\temail2[i] = tolower(left_bracket2[i + 1]);\n+\t\t\temail2[right_bracket2 - left_bracket2 - 1] = '\\0';\n+\t\t\tchar *tmp = email1;\n+\t\t\temail1 = email2;\n+\t\t\temail2 = tmp;\n+\t\t} while(0);\n+\n+\t\tadd_mapping(map, name1, email1, name2, email2);\n \t}\n \tfclose(f);\n \treturn 0;\n }\n \n-int map_email(struct string_list *map, const char *email, char *name, int maxlen)\n+void clear_mailmap(struct string_list *map)\n+{\n+\tdebug_mm(\"mailmap: clearing %d entries...\\n\", map->nr);\n+\tmap->strdup_strings = 1;\n+\tstring_list_clear_func(map, free_mailmap_entry);\n+\tdebug_mm(\"mailmap: cleared\\n\");\n+}\n+\n+int map_user(struct string_list *map,\n+\t     char *email, int maxlen_email, char *name, int maxlen_name)\n {\n \tchar *p;\n \tstruct string_list_item *item;\n+\tstruct mailmap_entry *me;\n \tchar buf[1024], *mailbuf;\n \tint i;\n \n-\t/* autocomplete common developers */\n+\t/* figure out space requirement for email */\n \tp = strchr(email, '>');\n-\tif (!p)\n-\t\treturn 0;\n+\tif (!p) {\n+\t\t/* email passed in might not be wrapped in <>, but end with a \\0 */\n+\t\tp = memchr(email, '\\0', maxlen_email);\n+\t\tif (p == 0)\n+\t\t\treturn 0;\n+\t}\n \tif (p - email + 1 < sizeof(buf))\n \t\tmailbuf = buf;\n \telse\n@@ -87,13 +221,39 @@ int map_email(struct string_list *map, const char *email, char *name, int maxlen\n \tfor (i = 0; i < p - email; i++)\n \t\tmailbuf[i] = tolower(email[i]);\n \tmailbuf[i] = 0;\n+\n+\tdebug_mm(\"map_user: map '%s' <%s>\\n\", name, mailbuf);\n \titem = string_list_lookup(mailbuf, map);\n+\tif (item != NULL) {\n+\t\tme = (struct mailmap_entry *)item->util;\n+\t\tif (me->namemap.nr) {\n+\t\t\t/* The item has multiple items, so we'll look up on name too */\n+\t\t\t/* If the name is not found, we choose the simple entry      */\n+\t\t\tstruct string_list_item *subitem = string_list_lookup(name, &me->namemap);\n+\t\t\tif (subitem)\n+\t\t\t\titem = subitem;\n+\t\t}\n+\t}\n \tif (mailbuf != buf)\n \t\tfree(mailbuf);\n \tif (item != NULL) {\n-\t\tconst char *realname = (const char *)item->util;\n-\t\tstrlcpy(name, realname, maxlen);\n+\t\tstruct mailmap_info *mi = (struct mailmap_info *)item->util;\n+\t\tif (mi->email == NULL && mi->name == NULL) {\n+\t\t\tdebug_mm(\"map_user:  -- (no simple mapping)\\n\");\n+\t\t\treturn 0;\n+\t\t}\n+\t\tif (maxlen_email && mi->email)\n+\t\t\tstrlcpy(email, mi->email, maxlen_email);\n+\t\tif (maxlen_name && mi->name)\n+\t\t\tstrlcpy(name, mi->name, maxlen_name);\n+\t\tdebug_mm(\"map_user:  to '%s' <%s>\\n\", name, mi->email ? email : mailbuf);\n \t\treturn 1;\n \t}\n+\tdebug_mm(\"map_user:  --\\n\");\n \treturn 0;\n }\n+\n+int map_email(struct string_list *map, const char *email, char *name, int maxlen)\n+{\n+\treturn map_user(map, (char *)email, 0, name, maxlen);\n+}\ndiff --git a/mailmap.h b/mailmap.h\nindex 6e48f83..1b5ae69 100644\n--- a/mailmap.h\n+++ b/mailmap.h\n@@ -2,6 +2,10 @@\n #define MAILMAP_H\n \n int read_mailmap(struct string_list *map, const char *filename, char **repo_abbrev);\n+void clear_mailmap(struct string_list *map);\n+\n int map_email(struct string_list *mailmap, const char *email, char *name, int maxlen);\n+int map_user(struct string_list *mailmap,\n+\t     char *email, int maxlen_email, char *name, int maxlen_name);\n \n #endif\n-- \n1.6.1.2.257.g34f62\n"},{"id":"102778","messageId":"68028794e4be1e67448838a88466ccb1a8b8de19.1233520945.git.marius@trolltech.com","threadId":"17491","inReplyTo":"0f360e115bde662b5297e803d8829b79c573ad58.1233520945.git.marius@trolltech.com","subject":"[PATCH v2 4/4] Change current mailmap usage to do matching on both name and email of author/committer.","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2009-02-01T20:59:59Z","receivedAt":"2009-02-01T20:59:59Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"\nSigned-off-by: Marius Storm-Olsen <marius@trolltech.com>\n---\n Documentation/pretty-formats.txt |    2 +\n builtin-blame.c                  |   50 ++++++++++++-------\n builtin-shortlog.c               |   22 +++++++--\n pretty.c                         |   59 ++++++++++++-----------\n t/t4203-mailmap.sh               |   99 ++++++++++++++++++++++++++++++++++++++\n 5 files changed, 180 insertions(+), 52 deletions(-)\n\ndiff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\nindex 3d87d3e..28808b7 100644\n--- a/Documentation/pretty-formats.txt\n+++ b/Documentation/pretty-formats.txt\n@@ -103,6 +103,7 @@ The placeholders are:\n - '%an': author name\n - '%aN': author name (respecting .mailmap)\n - '%ae': author email\n+- '%aE': author email (respecting .mailmap)\n - '%ad': author date (format respects --date= option)\n - '%aD': author date, RFC2822 style\n - '%ar': author date, relative\n@@ -111,6 +112,7 @@ The placeholders are:\n - '%cn': committer name\n - '%cN': committer name (respecting .mailmap)\n - '%ce': committer email\n+- '%cE': committer email (respecting .mailmap)\n - '%cd': committer date\n - '%cD': committer date, RFC2822 style\n - '%cr': committer date, relative\ndiff --git a/builtin-blame.c b/builtin-blame.c\nindex 4b63775..c166ba1 100644\n--- a/builtin-blame.c\n+++ b/builtin-blame.c\n@@ -1263,11 +1263,12 @@ struct commit_info\n  * Parse author/committer line in the commit object buffer\n  */\n static void get_ac_line(const char *inbuf, const char *what,\n-\t\t\tint bufsz, char *person, const char **mail,\n+\t\t\tint person_len, char *person,\n+\t\t\tint mail_len, char *mail,\n \t\t\tunsigned long *time, const char **tz)\n {\n \tint len, tzlen, maillen;\n-\tchar *tmp, *endp, *timepos;\n+\tchar *tmp, *endp, *timepos, *mailpos;\n \n \ttmp = strstr(inbuf, what);\n \tif (!tmp)\n@@ -1278,10 +1279,11 @@ static void get_ac_line(const char *inbuf, const char *what,\n \t\tlen = strlen(tmp);\n \telse\n \t\tlen = endp - tmp;\n-\tif (bufsz <= len) {\n+\tif (person_len <= len) {\n \terror_out:\n \t\t/* Ugh */\n-\t\t*mail = *tz = \"(unknown)\";\n+\t\t*tz = \"(unknown)\";\n+\t\tstrcpy(mail, *tz);\n \t\t*time = 0;\n \t\treturn;\n \t}\n@@ -1304,9 +1306,10 @@ static void get_ac_line(const char *inbuf, const char *what,\n \t*tmp = 0;\n \twhile (*tmp != ' ')\n \t\ttmp--;\n-\t*mail = tmp + 1;\n+\tmailpos = tmp + 1;\n \t*tmp = 0;\n \tmaillen = timepos - tmp;\n+\tmemcpy(mail, mailpos, maillen);\n \n \tif (!mailmap.nr)\n \t\treturn;\n@@ -1315,20 +1318,23 @@ static void get_ac_line(const char *inbuf, const char *what,\n \t * mailmap expansion may make the name longer.\n \t * make room by pushing stuff down.\n \t */\n-\ttmp = person + bufsz - (tzlen + 1);\n+\ttmp = person + person_len - (tzlen + 1);\n \tmemmove(tmp, *tz, tzlen);\n \ttmp[tzlen] = 0;\n \t*tz = tmp;\n \n-\ttmp = tmp - (maillen + 1);\n-\tmemmove(tmp, *mail, maillen);\n-\ttmp[maillen] = 0;\n-\t*mail = tmp;\n-\n \t/*\n-\t * Now, convert e-mail using mailmap\n+\t * Now, convert both name and e-mail using mailmap\n \t */\n-\tmap_email(&mailmap, tmp + 1, person, tmp-person-1);\n+\tif(map_user(&mailmap, mail+1, mail_len-1, person, tmp-person-1)) {\n+\t\t/* Add a trailing '>' to email, since map_user returns plain emails\n+\t\t   Note: It already has '<', since we replace from mail+1 */\n+\t\tmailpos = memchr(mail, '\\0', mail_len);\n+\t\tif (mailpos && mailpos-mail < mail_len - 1) {\n+\t\t\t*mailpos = '>';\n+\t\t\t*(mailpos+1) = '\\0';\n+\t\t}\n+\t}\n }\n \n static void get_commit_info(struct commit *commit,\n@@ -1337,8 +1343,10 @@ static void get_commit_info(struct commit *commit,\n {\n \tint len;\n \tchar *tmp, *endp, *reencoded, *message;\n-\tstatic char author_buf[1024];\n-\tstatic char committer_buf[1024];\n+\tstatic char author_name[1024];\n+\tstatic char author_mail[1024];\n+\tstatic char committer_name[1024];\n+\tstatic char committer_mail[1024];\n \tstatic char summary_buf[1024];\n \n \t/*\n@@ -1356,9 +1364,11 @@ static void get_commit_info(struct commit *commit,\n \t}\n \treencoded = reencode_commit_message(commit, NULL);\n \tmessage   = reencoded ? reencoded : commit->buffer;\n-\tret->author = author_buf;\n+\tret->author = author_name;\n+\tret->author_mail = author_mail;\n \tget_ac_line(message, \"\\nauthor \",\n-\t\t    sizeof(author_buf), author_buf, &ret->author_mail,\n+\t\t    sizeof(author_name), author_name,\n+\t\t    sizeof(author_mail), author_mail,\n \t\t    &ret->author_time, &ret->author_tz);\n \n \tif (!detailed) {\n@@ -1366,9 +1376,11 @@ static void get_commit_info(struct commit *commit,\n \t\treturn;\n \t}\n \n-\tret->committer = committer_buf;\n+\tret->committer = committer_name;\n+\tret->committer_mail = committer_mail;\n \tget_ac_line(message, \"\\ncommitter \",\n-\t\t    sizeof(committer_buf), committer_buf, &ret->committer_mail,\n+\t\t    sizeof(committer_name), committer_name,\n+\t\t    sizeof(committer_mail), committer_mail,\n \t\t    &ret->committer_time, &ret->committer_tz);\n \n \tret->summary = summary_buf;\ndiff --git a/builtin-shortlog.c b/builtin-shortlog.c\nindex 04832a8..19975ce 100644\n--- a/builtin-shortlog.c\n+++ b/builtin-shortlog.c\n@@ -40,6 +40,7 @@ static void insert_one_record(struct shortlog *log,\n \tchar *buffer, *p;\n \tstruct string_list_item *item;\n \tchar namebuf[1024];\n+\tchar emailbuf[1024];\n \tsize_t len;\n \tconst char *eol;\n \tconst char *boemail, *eoemail;\n@@ -51,7 +52,19 @@ static void insert_one_record(struct shortlog *log,\n \teoemail = strchr(boemail, '>');\n \tif (!eoemail)\n \t\treturn;\n-\tif (!map_email(&log->mailmap, boemail+1, namebuf, sizeof(namebuf))) {\n+\n+\t/* copy author name to namebuf, to support matching on both name and email */\n+\tmemcpy(namebuf, author, boemail - author);\n+\tlen = boemail - author;\n+\twhile(len > 0 && isspace(namebuf[len-1]))\n+\t\tlen--;\n+\tnamebuf[len] = 0;\n+\n+\t/* copy email name to emailbuf, to allow email replacement as well */\n+\tmemcpy(emailbuf, boemail+1, eoemail - boemail);\n+\temailbuf[eoemail - boemail - 1] = 0;\n+\n+\tif (!map_user(&log->mailmap, emailbuf, sizeof(emailbuf), namebuf, sizeof(namebuf))) {\n \t\twhile (author < boemail && isspace(*author))\n \t\t\tauthor++;\n \t\tfor (len = 0;\n@@ -67,8 +80,8 @@ static void insert_one_record(struct shortlog *log,\n \n \tif (log->email) {\n \t\tsize_t room = sizeof(namebuf) - len - 1;\n-\t\tint maillen = eoemail - boemail + 1;\n-\t\tsnprintf(namebuf + len, room, \" %.*s\", maillen, boemail);\n+\t\tint maillen = strlen(emailbuf);\n+\t\tsnprintf(namebuf + len, room, \" <%.*s>\", maillen, emailbuf);\n \t}\n \n \titem = string_list_insert(namebuf, &log->list);\n@@ -321,6 +334,5 @@ void shortlog_output(struct shortlog *log)\n \n \tlog->list.strdup_strings = 1;\n \tstring_list_clear(&log->list, 1);\n-\tlog->mailmap.strdup_strings = 1;\n-\tstring_list_clear(&log->mailmap, 1);\n+\tclear_mailmap(&log->mailmap);\n }\ndiff --git a/pretty.c b/pretty.c\nindex cc460b5..e93e472 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -305,23 +305,14 @@ static char *logmsg_reencode(const struct commit *commit,\n \treturn out;\n }\n \n-static int mailmap_name(struct strbuf *sb, const char *email)\n+static int mailmap_name(char *email, int email_len, char *name, int name_len)\n {\n \tstatic struct string_list *mail_map;\n-\tchar buffer[1024];\n-\n \tif (!mail_map) {\n \t\tmail_map = xcalloc(1, sizeof(*mail_map));\n-\t\tread_mailmap(mail_map, \".mailmap\", NULL);\n+\t\tread_mailmap(mail_map, NULL, NULL);\n \t}\n-\n-\tif (!mail_map->nr)\n-\t\treturn -1;\n-\n-\tif (!map_email(mail_map, email, buffer, sizeof(buffer)))\n-\t\treturn -1;\n-\tstrbuf_addstr(sb, buffer);\n-\treturn 0;\n+\treturn mail_map->nr && map_user(mail_map, email, email_len, name, name_len);\n }\n \n static size_t format_person_part(struct strbuf *sb, char part,\n@@ -332,6 +323,9 @@ static size_t format_person_part(struct strbuf *sb, char part,\n \tint start, end, tz = 0;\n \tunsigned long date = 0;\n \tchar *ep;\n+\tconst char *name_start, *name_end, *mail_start, *mail_end, *msg_end = msg+len;\n+\tchar person_name[1024];\n+\tchar person_mail[1024];\n \n \t/* advance 'end' to point to email start delimiter */\n \tfor (end = 0; end < len && msg[end] != '<'; end++)\n@@ -345,25 +339,34 @@ static size_t format_person_part(struct strbuf *sb, char part,\n \tif (end >= len - 2)\n \t\tgoto skip;\n \n+\t/* Seek for both name and email part */\n+\tname_start = msg;\n+\tname_end = msg+end;\n+\twhile (name_end > name_start && isspace(*(name_end-1)))\n+\t\tname_end--;\n+\tmail_start = msg+end+1;\n+\tmail_end = mail_start;\n+\twhile (mail_end < msg_end && *mail_end != '>')\n+\t\tmail_end++;\n+\tif (mail_end == msg_end)\n+\t\tgoto skip;\n+\tend = mail_end-msg;\n+\n+\tif (part == 'N' || part == 'E') { /* mailmap lookup */\n+\t\tstrlcpy(person_name, name_start, name_end-name_start+1);\n+\t\tstrlcpy(person_mail, mail_start, mail_end-mail_start+1);\n+\t\tmailmap_name(person_mail, sizeof(person_mail), person_name, sizeof(person_name));\n+\t\tname_start = person_name;\n+\t\tname_end = name_start + strlen(person_name);\n+\t\tmail_start = person_mail;\n+\t\tmail_end = mail_start +  strlen(person_mail);\n+\t}\n \tif (part == 'n' || part == 'N') {\t/* name */\n-\t\twhile (end > 0 && isspace(msg[end - 1]))\n-\t\t\tend--;\n-\t\tif (part != 'N' || !msg[end] || !msg[end + 1] ||\n-\t\t    mailmap_name(sb, msg + end + 2) < 0)\n-\t\t\tstrbuf_add(sb, msg, end);\n+\t\tstrbuf_add(sb, name_start, name_end-name_start);\n \t\treturn placeholder_len;\n \t}\n-\tstart = ++end; /* save email start position */\n-\n-\t/* advance 'end' to point to email end delimiter */\n-\tfor ( ; end < len && msg[end] != '>'; end++)\n-\t\t; /* do nothing */\n-\n-\tif (end >= len)\n-\t\tgoto skip;\n-\n-\tif (part == 'e') {\t/* email */\n-\t\tstrbuf_add(sb, msg + start, end - start);\n+\tif (part == 'e' || part == 'E') {\t/* email */\n+\t\tstrbuf_add(sb, mail_start, mail_end-mail_start);\n \t\treturn placeholder_len;\n \t}\n \ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 57fd88e..271ef26 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -50,4 +50,103 @@ test_expect_success 'No mailmap files, but configured' '\n \ttest_cmp expect actual\n '\n \n+# Extended mailmap configurations should give us the following output for shortlog\n+cat >expect <<\\EOF\n+A U Thor <author@example.com> (1):\n+      initial\n+\n+Other Author <other@author.xx> (2):\n+      third\n+      fourth\n+\n+Santa Claus <santa.claus@northpole.xx> (2):\n+      fifth\n+      sixth\n+\n+Some Dude <some@dude.xx> (1):\n+      second\n+\n+EOF\n+\n+test_expect_success 'Shortlog output (complex mapping)' '\n+\n+\techo two >>one &&\n+\tgit add one &&\n+\ttest_tick &&\n+\tgit commit --author \"nick1 <bugs@company.xx>\" -m second &&\n+\n+\techo three >>one &&\n+\tgit add one &&\n+\ttest_tick &&\n+\tgit commit --author \"nick2 <bugs@company.xx>\" -m third &&\n+\n+\techo four >>one &&\n+\tgit add one &&\n+\ttest_tick &&\n+\tgit commit --author \"nick2 <nick2@company.xx>\" -m fourth &&\n+\n+\techo five >>one &&\n+\tgit add one &&\n+\ttest_tick &&\n+\tgit commit --author \"santa <me@company.xx>\" -m fifth &&\n+\n+\techo six >>one &&\n+\tgit add one &&\n+\ttest_tick &&\n+\tgit commit --author \"claus <me@company.xx>\" -m sixth &&\n+\n+\tmkdir internal_mailmap &&\n+\techo \"Committed <committer@example.com>\" > internal_mailmap/.mailmap &&\n+\techo \"Some Dude <some@dude.xx>         nick1 <bugs@company.xx>\" >> internal_mailmap/.mailmap &&\n+\techo \"Other Author <other@author.xx>   nick2 <bugs@company.xx>\" >> internal_mailmap/.mailmap &&\n+\techo \"Other Author <other@author.xx>         <nick2@company.xx>\" >> internal_mailmap/.mailmap &&\n+\techo \"Santa Claus <santa.claus@northpole.xx> <me@company.xx>\" >> internal_mailmap/.mailmap &&\n+\techo \"Santa Claus <santa.claus@northpole.xx> <me@company.xx>\" >> internal_mailmap/.mailmap &&\n+\n+\tgit shortlog -e >actual &&\n+\ttest_cmp expect actual\n+\n+'\n+\n+# git log with --pretty format which uses the name and email mailmap placemarkers\n+cat >expect <<\\EOF\n+Author claus <me@company.xx> maps to Santa Claus <santa.claus@northpole.xx>\n+Committer C O Mitter <committer@example.com> maps to Committed <committer@example.com>\n+\n+Author santa <me@company.xx> maps to Santa Claus <santa.claus@northpole.xx>\n+Committer C O Mitter <committer@example.com> maps to Committed <committer@example.com>\n+\n+Author nick2 <nick2@company.xx> maps to Other Author <other@author.xx>\n+Committer C O Mitter <committer@example.com> maps to Committed <committer@example.com>\n+\n+Author nick2 <bugs@company.xx> maps to Other Author <other@author.xx>\n+Committer C O Mitter <committer@example.com> maps to Committed <committer@example.com>\n+\n+Author nick1 <bugs@company.xx> maps to Some Dude <some@dude.xx>\n+Committer C O Mitter <committer@example.com> maps to Committed <committer@example.com>\n+\n+Author A U Thor <author@example.com> maps to A U Thor <author@example.com>\n+Committer C O Mitter <committer@example.com> maps to Committed <committer@example.com>\n+EOF\n+\n+test_expect_success 'Log output (complex mapping)' '\n+\tgit log --pretty=format:\"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n\" >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+# git blame\n+cat >expect <<\\EOF\n+^3a2fdcb (A U Thor     2005-04-07 15:13:13 -0700 1) one\n+e0f60492 (Some Dude    2005-04-07 15:14:13 -0700 2) two\n+4db1a3df (Other Author 2005-04-07 15:15:13 -0700 3) three\n+e3718380 (Other Author 2005-04-07 15:16:13 -0700 4) four\n+25e4bf3d (Santa Claus  2005-04-07 15:17:13 -0700 5) five\n+17c39712 (Santa Claus  2005-04-07 15:18:13 -0700 6) six\n+EOF\n+\n+test_expect_success 'Blame output (complex mapping)' '\n+\tgit blame one >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\n-- \n1.6.1.2.257.g34f62\n"},{"id":"102808","messageId":"7vwsc9o82r.fsf@gitster.siamese.dyndns.org","threadId":"17491","inReplyTo":"ce94ea88e3182e97997c23f71e184e0db64fa708.1233520945.git.marius@trolltech.com","subject":"Re: [PATCH v2 1/4] Add log.mailmap as configurational option for mailmap location","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-02T03:01:48Z","receivedAt":"2009-02-02T03:01:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marius Storm-Olsen <marius@trolltech.com> writes:\n\n> This allows us to override a repo mailmap file, or to use\n> mailmap files elsewhere than the repository root.\n\nI think the new feature is not so well conceived.\n\nShould it always be a wholesale override, or should it also support\naugmenting the repository version with a private copy?\n\n> diff --git a/builtin-blame.c b/builtin-blame.c\n> index aae14ef..4b63775 100644\n> --- a/builtin-blame.c\n> +++ b/builtin-blame.c\n> @@ -2394,7 +2394,7 @@ parse_done:\n>  \t\tdie(\"reading graft file %s failed: %s\",\n>  \t\t    revs_file, strerror(errno));\n>  \n> -\tread_mailmap(&mailmap, \".mailmap\", NULL);\n> +\tread_mailmap(&mailmap, NULL, NULL);\n\nYour callers always seem to pass NULL for the second argument.  Doesn't it\nmake a lot more sense to get rid of it?\n"},{"id":"102809","messageId":"7vpri1o801.fsf@gitster.siamese.dyndns.org","threadId":"17491","inReplyTo":"cover.1233520945.git.marius@trolltech.com","subject":"Re: [PATCH v2 0/4] Extend mailmap functionality","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-02T03:03:26Z","receivedAt":"2009-02-02T03:03:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marius Storm-Olsen <marius@trolltech.com> writes:\n\n> 2) Lets you replace both name and email of an author/committer, based\n> on a name and/or email. So, should you have done commits with faulty\n> address, or if an old email simply isn't valid anymore, you can add\n> a mapping for that to replace it. So, the old style mapping is\n>     Proper Name <commit@email.xx>\n>\n> while this patch series adds support for\n>     Proper Name <proper@email.xx> <commit@email.xx>\n>     Proper Name <proper@email.xx> Commit Name <commit@email.xx>\n>\n> This extended mapping is necessary when a company wants to have their\n> repositories open to the public, but needs to protect the identities\n> of the developers. It enables you to only show nicks and standardized\n> emails, like 'Dev123 <bugs@company.xx>' in the public repo, but by\n> using an private mailmap file, map the name back to\n> 'John Doe <john.doe@company.xx>' inside the company.\n\nI do not find the \"necessary\" argument very convincing nor I find the\nparticular use case sane.  You may want to do things that way, but I do\nnot know if it is the best way to go about it.\n\nThe new mapping however brings in more flexibility, and there may be other\nuse cases where people benefit from that flexibility.  I am slightly in\nfavor than neutral to this new feature.\n"},{"id":"102810","messageId":"7viqnto7zo.fsf@gitster.siamese.dyndns.org","threadId":"17491","inReplyTo":"75a7d437c1b32600c509bdef5010e6ac30b6cb08.1233520945.git.marius@trolltech.com","subject":"Re: [PATCH v2 2/4] Add find_insert_index, insert_at_index and clear_func functions to string_list","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-02T03:03:39Z","receivedAt":"2009-02-02T03:03:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marius Storm-Olsen <marius@trolltech.com> writes:\n\n> string_list_find_insert_index() and string_list_insert_at_index() enables you to see if an item is in the string_list, and to insert at the appropriate index in the list, if not there.\n> This is usefull if you need to manipulate an existing item, if present, and insert a new item if not.\n>\n> Future mailmap code will use this construct to enable complex (old_name, old_email) -> (new_name, new_email) lookups.\n>\n> The string_list_clear_func() allows to call a custom cleanup function on each item in a string_list, which is useful is the util member points to a complex structure.\n\nWhat's with these overlong lines?  You do not have them in your other\npatches.\n"},{"id":"102823","messageId":"bd6139dc0902012126g605eb6d3v2a2d788a983dc65c@mail.gmail.com","threadId":"17491","inReplyTo":"7vpri1o801.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 0/4] Extend mailmap functionality","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-02-02T05:26:03Z","receivedAt":"2009-02-02T05:26:03Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"On Mon, Feb 2, 2009 at 04:03, Junio C Hamano <gitster@pobox.com> wrote:\n> The new mapping however brings in more flexibility, and there may be other\n> use cases where people benefit from that flexibility.  I am slightly in\n> favor than neutral to this new feature.\n\nIt sure does, I use git-svn for a project hosted on Google Code, and\nthe e-mail addresses are totally borked (e.g., \"gmail-account-id\"\n<gmail-account-id@the-svn-repo-uuid>). Not only that, but some\ndevelopers (including me I must admit) have a rather obscure\ngmail-account-id, which is uses as the user's name for the commit\nmessage. It would be very nice if I could provide a mapping from\n\"borked svn id's\" to \"normal, sensible e-mail addresses, including\nreal names\", a feature which this series seems to add :).\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"102834","messageId":"4986A539.3080606@trolltech.com","threadId":"17491","inReplyTo":"7vwsc9o82r.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 1/4] Add log.mailmap as configurational option for mailmap location","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2009-02-02T07:48:09Z","receivedAt":"2009-02-02T07:48:09Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"Junio C Hamano said the following on 02.02.2009 04:01:\n> Marius Storm-Olsen <marius@trolltech.com> writes:\n>> This allows us to override a repo mailmap file, or to use\n>> mailmap files elsewhere than the repository root.\n> \n> I think the new feature is not so well conceived.\n> \n> Should it always be a wholesale override, or should it also support\n> augmenting the repository version with a private copy?\n\nSure, I can rewrite it to be augmenting, rather than overriding.\nI assume that the normal .mailmap file should be parsed first, then \nthe log.mailmap one?\n\n\n>> diff --git a/builtin-blame.c b/builtin-blame.c\n>> index aae14ef..4b63775 100644\n>> --- a/builtin-blame.c\n>> +++ b/builtin-blame.c\n>> @@ -2394,7 +2394,7 @@ parse_done:\n>>  \t\tdie(\"reading graft file %s failed: %s\",\n>>  \t\t    revs_file, strerror(errno));\n>>  \n>> -\tread_mailmap(&mailmap, \".mailmap\", NULL);\n>> +\tread_mailmap(&mailmap, NULL, NULL);\n> \n> Your callers always seem to pass NULL for the second argument.  Doesn't it\n> make a lot more sense to get rid of it?\n\nSure, but I left it in to allow \"old-style\" usage. Just in case the \nwere use-cases for not using the log.mailmap one. I can nuke the \narguments if you don't want them anymore.\n\n-- \n.marius [@trolltech.com]\n'if you know what you're doing, it's not research'\n\n"},{"id":"102836","messageId":"4986A5A7.2000900@trolltech.com","threadId":"17491","inReplyTo":"7viqnto7zo.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 2/4] Add find_insert_index, insert_at_index and clear_func functions to string_list","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2009-02-02T07:49:59Z","receivedAt":"2009-02-02T07:49:59Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"Junio C Hamano said the following on 02.02.2009 04:03:\n> Marius Storm-Olsen <marius@trolltech.com> writes:\n> \n>> string_list_find_insert_index() and string_list_insert_at_index()\n>> enables you to see if an item is in the string_list, and to\n>> insert at the appropriate index in the list, if not there. This\n>> is usefull if you need to manipulate an existing item, if\n>> present, and insert a new item if not.\n>> \n>> Future mailmap code will use this construct to enable complex\n>> (old_name, old_email) -> (new_name, new_email) lookups.\n>> \n>> The string_list_clear_func() allows to call a custom cleanup\n>> function on each item in a string_list, which is useful is the\n>> util member points to a complex structure.\n> \n> What's with these overlong lines?  You do not have them in your\n> other patches.\n\nSorry, that was my editor which wrapped them visibly at column 70, and \nI forgot to insert manual line-breaks before saving.\nI'll correct it for the next version.\n\n-- \n.marius [@trolltech.com]\n'if you know what you're doing, it's not research'\n\n"},{"id":"102837","messageId":"7vr62hl1a3.fsf@gitster.siamese.dyndns.org","threadId":"17491","inReplyTo":"4986A539.3080606@trolltech.com","subject":"Re: [PATCH v2 1/4] Add log.mailmap as configurational option for mailmap location","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-02T07:56:52Z","receivedAt":"2009-02-02T07:56:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marius Storm-Olsen <marius@trolltech.com> writes:\n\n> Junio C Hamano said the following on 02.02.2009 04:01:\n>> Marius Storm-Olsen <marius@trolltech.com> writes:\n>>> This allows us to override a repo mailmap file, or to use\n>>> mailmap files elsewhere than the repository root.\n>>\n>> I think the new feature is not so well conceived.\n>>\n>> Should it always be a wholesale override, or should it also support\n>> augmenting the repository version with a private copy?\n>\n> Sure, I can rewrite it to be augmenting, rather than overriding.\n> I assume that the normal .mailmap file should be parsed first, then\n> the log.mailmap one?\n\nAugmenting one would behave that way.  I was more wondering if people\nwould want to be able to choose either, perhaps from the command line\noption or something.\n\n> Sure, but I left it in to allow \"old-style\" usage. Just in case the\n> were use-cases for not using the log.mailmap one. I can nuke the\n> arguments if you don't want them anymore.\n\nWhat I think would be sensible, if we really want to make this feature\nflexible, would be to introduce a command line option (and perhaps\nenvironment variable) that takes the usual precidence (the command line\nthat specifies the mailmap file, then the environment and then finally the\nlog.mailmap config variable).  And if we go that route, that \"usuall NULL\"\nparameter would be where the callers pass the filename they got from their\ncommand line.\n\nBut if you feel it is overengineering, I would not disagree.  In such a\ncase, however, I do not think there is a reason for one particular caller\nto pass some custom value there, just to be inconsistent from others.\n"},{"id":"102840","messageId":"4986A9CE.9040009@trolltech.com","threadId":"17491","inReplyTo":"7vpri1o801.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 0/4] Extend mailmap functionality","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2009-02-02T08:07:42Z","receivedAt":"2009-02-02T08:07:42Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"Junio C Hamano said the following on 02.02.2009 04:03:\n>> This extended mapping is necessary when a company wants to have\n>> their repositories open to the public, but needs to protect the\n>> identities of the developers. It enables you to only show nicks\n>> and standardized emails, like 'Dev123 <bugs@company.xx>' in the\n>> public repo, but by using an private mailmap file, map the name\n>> back to 'John Doe <john.doe@company.xx>' inside the company.\n> \n> I do not find the \"necessary\" argument very convincing nor I find\n> the particular use case sane.  You may want to do things that way,\n> but I do not know if it is the best way to go about it.\n\nWell, this is the use-case for my company. We have open-source repos, \nwhich are the exact same repos which the company's developers work on, \nnot a modified mirror repo.\nHowever, laws in some countries requires that employees information be \nkept away from the public, should they so wish. So, for our developers \nto work on the exact same repo as the open-source community, we need a \nway to map both Names and Emails back to the original author, inside \nthe company without using a different repo.\n\nAlso, the company commit policy might be such that the email on the \ncommit is always the companys <bugs@company.xx>. This might be so that \nif someone finds a bug to your commit, they send the bug report to the \ncompanys bug-tracker instead of the individual email address.\nHowever, that breaks the old mailmap system, since it requires unique \nemail addresses to map to a name.\n\n> The new mapping however brings in more flexibility, and there may\n> be other use cases where people benefit from that flexibility.  I\n> am slightly in favor than neutral to this new feature.\n\nYou could use this feature in git.git itself, where for example\n     Junio C Hamano <gitster@pobox.com>\n     Junio C Hamano <gitster@pobox.com> <junio@twinsun.com>\n(or any of the others in the .mailmap file with X number of different \nemail addresses), to ensure that you are always associated with one \nspecific email address.\n\n-- \n.marius [@trolltech.com]\n'if you know what you're doing, it's not research'\n\n"},{"id":"102841","messageId":"4986AE47.3010305@trolltech.com","threadId":"17491","inReplyTo":"7vr62hl1a3.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 1/4] Add log.mailmap as configurational option for mailmap location","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2009-02-02T08:26:47Z","receivedAt":"2009-02-02T08:26:47Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"Junio C Hamano said the following on 02.02.2009 08:56:\n> Marius Storm-Olsen <marius@trolltech.com> writes:\n>> Junio C Hamano said the following on 02.02.2009 04:01:\n>>> Should it always be a wholesale override, or should it also\n>>> support augmenting the repository version with a private copy?\n>> Sure, I can rewrite it to be augmenting, rather than overriding. \n>> I assume that the normal .mailmap file should be parsed first,\n>> then the log.mailmap one?\n> \n> Augmenting one would behave that way.  I was more wondering if\n> people would want to be able to choose either, perhaps from the\n> command line option or something.\n\nOh, I see. *ponder* maybe, though you could say that about any option \nin the .git/config file, right?\n\n\n>> Sure, but I left it in to allow \"old-style\" usage. Just in case\n>> the were use-cases for not using the log.mailmap one. I can nuke\n>> the arguments if you don't want them anymore.\n> \n> What I think would be sensible, if we really want to make this\n> feature flexible, would be to introduce a command line option (and\n> perhaps environment variable) that takes the usual precidence (the\n> command line that specifies the mailmap file, then the environment\n> and then finally the log.mailmap config variable).  And if we go\n> that route, that \"usuall NULL\" parameter would be where the callers\n> pass the filename they got from their command line.\n> \n> But if you feel it is overengineering, I would not disagree.  In\n> such a case, however, I do not think there is a reason for one\n> particular caller to pass some custom value there, just to be\n> inconsistent from others.\n\nI'm not sure of the use case of the command line option. In which case \nwould you want to only use the mailmap for that one command? It \ndoesn't normally affect your git commands, so it doesn't hurt to just \nset the log.mailmap option. The environment use case would be just \nlike setting it in your ~/.gitconfig, other than you can have a \ndifferent one for each console, I guess.\n\nNow, if we extended the mailmap feature even further, to report the \nmappings from the rev-list code ((optional of course)), so that any \nlog viewer would show the mapped information; _then_ I would consider \nthe command-line and environment variables as mandatory. Since, then \nyou might want the feature off by default, and only use the mappings \nwhen you need to figure out a breakage, thus need a quick way to \nenable it.\n\nSo, unless anyone raises their hand that they need \ncommand-line/environment ways of setting the mailmap file used, I'll \nleave it as is for now. Ok?\n\n-- \n.marius [@trolltech.com]\n'if you know what you're doing, it's not research'\n\n"},{"id":"102846","messageId":"7vr62hjkpm.fsf@gitster.siamese.dyndns.org","threadId":"17491","inReplyTo":"4986AE47.3010305@trolltech.com","subject":"Re: [PATCH v2 1/4] Add log.mailmap as configurational option for mailmap location","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-02T08:40:05Z","receivedAt":"2009-02-02T08:40:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marius Storm-Olsen <marius@trolltech.com> writes:\n\n> Junio C Hamano said the following on 02.02.2009 08:56:\n>> Marius Storm-Olsen <marius@trolltech.com> writes:\n>>> Junio C Hamano said the following on 02.02.2009 04:01:\n>>>> Should it always be a wholesale override, or should it also\n>>>> support augmenting the repository version with a private copy?\n>>> Sure, I can rewrite it to be augmenting, rather than overriding. I\n>>> assume that the normal .mailmap file should be parsed first,\n>>> then the log.mailmap one?\n>>\n>> Augmenting one would behave that way.  I was more wondering if\n>> people would want to be able to choose either, perhaps from the\n>> command line option or something.\n>\n> Oh, I see. *ponder* maybe, though you could say that about any option\n> in the .git/config file, right?\n\nI was more thinking along the line of how .gitignore works, accumulating\nexclude patterns we find from .gitignore files along the way while\ndescending into the directory hierarchy, and all the while honoring what\nthe user added in .git/info/excludes.\n\n> I'm not sure of the use case of the command line option. In which case\n> would you want to only use the mailmap for that one command? It\n> doesn't normally affect your git commands, so it doesn't hurt to just\n> set the log.mailmap option. The environment use case would be just\n> like setting it in your ~/.gitconfig, other than you can have a\n> different one for each console, I guess.\n\nYeah, that is exactly why I suggested you to say that is overengineered\nand is not useful ;-)\n\n> Now, if we extended the mailmap feature even further, to report the\n> mappings from the rev-list code ((optional of course)), so that any\n> log viewer would show the mapped information; _then_ I would consider\n> the command-line and environment variables as mandatory. Since, then\n> you might want the feature off by default, and only use the mappings\n> when you need to figure out a breakage, thus need a quick way to\n> enable it.\n\nNow you mention it, it might be wonderful if \"git log --author\" honored\nthe mailmap file, but I do not think command line nor environment do not\nhave much to do with it.\n\nIn any case, it is an independent issue from how mailmap maching and\nrewriting should work, which was the main point fo your series.\n\n> So, unless anyone raises their hand that they need\n> command-line/environment ways of setting the mailmap file used, I'll\n> leave it as is for now. Ok?\n\nMy point was that you should drop the second always-NULL parameter if the\nplan is not to have any command line filename.  And I agree with your\nreasoning that a command line filename is not useful, so...\n"}]}