{"thread":{"id":"43362","subject":"[PATCH 2/2] git-shortlog: make common repository prefix configurable with .mailmap","startedAt":"2006-11-25T08:11:02Z","lastAt":"2021-01-15T05:54:56Z","messageCount":50,"participants":["Junio C Hamano","Ævar Arnfjörð Bjarmason","Linus Torvalds","Martin Ågren","Denton Liu","Philippe Blain"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"294503","messageId":"7vejrs54kp.fsf@assigned-by-dhcp.cox.net","threadId":"43362","inReplyTo":null,"subject":"[PATCH 2/2] git-shortlog: make common repository prefix configurable with .mailmap","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-25T08:11:02Z","receivedAt":"2006-11-25T08:11:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The code had \"/pub/scm/linux/kernel/git/\" hardcoded which was\ntoo specific to the kernel project.\n\nWith this, a line in the .mailmap file:\n\n\t# repo-abbrev: /pub/scm/linux/kernel/git/\n\ncan be used to cause the substring to be abbreviated to /.../\non the title line of the commit message.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n builtin-shortlog.c    |   24 ++++++++++++++++++++++--\n contrib/mailmap.linux |    2 ++\n 2 files changed, 24 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-shortlog.c b/builtin-shortlog.c\nindex bdd952c..b5b13de 100644\n--- a/builtin-shortlog.c\n+++ b/builtin-shortlog.c\n@@ -9,6 +9,8 @@\n static const char shortlog_usage[] =\n \"git-shortlog [-n] [-s] [<commit-id>... ]\";\n \n+static char *common_repo_prefix;\n+\n static int compare_by_number(const void *a1, const void *a2)\n {\n \tconst struct path_list_item *i1 = a1, *i2 = a2;\n@@ -35,8 +37,26 @@ static int read_mailmap(const char *filename)\n \t\tchar *end_of_name, *left_bracket, *right_bracket;\n \t\tchar *name, *email;\n \t\tint i;\n-\t\tif (buffer[0] == '#')\n+\t\tif (buffer[0] == '#') {\n+\t\t\tstatic const char abbrev[] = \"# repo-abbrev:\";\n+\t\t\tint abblen = sizeof(abbrev) - 1;\n+\t\t\tint len = strlen(buffer);\n+\n+\t\t\tif (len && buffer[len - 1] == '\\n')\n+\t\t\t\tbuffer[--len] = 0;\n+\t\t\tif (!strncmp(buffer, abbrev, abblen)) {\n+\t\t\t\tchar *cp;\n+\n+\t\t\t\tif (common_repo_prefix)\n+\t\t\t\t\tfree(common_repo_prefix);\n+\t\t\t\tcommon_repo_prefix = xmalloc(len);\n+\n+\t\t\t\tfor (cp = buffer + abblen; isspace(*cp); cp++)\n+\t\t\t\t\t; /* nothing */\n+\t\t\t\tstrcpy(common_repo_prefix, cp);\n+\t\t\t}\n \t\t\tcontinue;\n+\t\t}\n \t\tif ((left_bracket = strchr(buffer, '<')) == NULL)\n \t\t\tcontinue;\n \t\tif ((right_bracket = strchr(left_bracket + 1, '>')) == NULL)\n@@ -87,7 +107,7 @@ static void insert_author_oneline(struct path_list *list,\n \t\tconst char *author, int authorlen,\n \t\tconst char *oneline, int onelinelen)\n {\n-\tconst char *dot3 = \"/pub/scm/linux/kernel/git/\";\n+\tconst char *dot3 = common_repo_prefix;\n \tchar *buffer, *p;\n \tstruct path_list_item *item;\n \tstruct path_list *onelines;\ndiff --git a/contrib/mailmap.linux b/contrib/mailmap.linux\nindex 83927c9..e4907f8 100644\n--- a/contrib/mailmap.linux\n+++ b/contrib/mailmap.linux\n@@ -3,6 +3,8 @@\n # So have an email->real name table to translate the\n # (hopefully few) missing names\n #\n+# repo-abbrev: /pub/scm/linux/kernel/git/\n+#\n Adrian Bunk <bunk@stusta.de>\n Andreas Herrmann <aherrman@de.ibm.com>\n Andrew Morton <akpm@osdl.org>\n-- \n1.4.4.1.g61fba\n\n"},{"id":"413449","messageId":"20210105130359.21139-1-avarab@gmail.com","threadId":"43362","inReplyTo":"7vejrs54kp.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] shortlog: remove unused(?) \"repo-abbrev\" feature","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-05T13:03:59Z","receivedAt":"2021-01-05T13:05:04Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove support for the magical \"repo-abbrev\" comment in .mailmap\nfiles. This was added to .mailmap parsing in [1], as a generalized\nfeature of the git-shortlog Perl script added earlier in [2].\n\nThere was no documentation or tests for this feature, and I don't\nthink it's used in practice anymore.\n\nWhat it did was to allow you to specify a single string to be\nsearch-replaced with \"/.../\" in the .mailmap file. E.g. for\nlinux.git's current .mailmap:\n\n    git archive --remote=git@gitlab.com:linux-kernel/linux.git \\\n        HEAD -- .mailmap | grep -a repo-abbrev\n    # repo-abbrev: /pub/scm/linux/kernel/git/\n\nThen when running e.g.:\n\n    git shortlog --merges --author=Linus -1 v5.10-rc7..v5.10 | grep Merge\n\nWe'd emit (the [...] is mine):\n\n      Merge tag [...]git://git.kernel.org/.../tip/tip\n\nBut will now emit:\n\n      Merge tag [...]git.kernel.org/pub/scm/linux/kernel/git/tip/tip\n\nI think at this point this is just a historical artifact we can get\nrid of. It was initially meant for Linus's own use when we integrated\nthe Perl script[2], but since then it seems he's stopped using it.\n\nDigging through Linus's release announcements on the LKML[3] the last\nrelease I can find that made use of this output is Linux 2.6.25-rc6\nback in March 2008[4]. Later on Linus started using --no-merges[5],\nand nowadays seems to prefer some custom not-quite-shortlog format of\nmerges from lieutenants[6].\n\nYou will still see it on linux.git if you run \"git shortlog\" manually\nyourself with --merges, with this removed you can still get the same\noutput with:\n\n    git log --pretty=fuller v5.10-rc7..v5.10 |\n    sed 's!/pub/scm/linux/kernel/git/!/.../!g' |\n    git shortlog\n\nArguably we should do the same for the search-replacing of \"[PATCH]\"\nat the beginning with \"\". That seems to be another relic of a bygone\nera when linux.git patches would have their E-Mail subject lines\napplied as-is by \"git am\" or whatever. But we documented that feature\nin \"git-shortlog(1)\", and it seems more widely applicable than\nsomething purely kernel-specific.\n\n1. 7595e2ee6ef (git-shortlog: make common repository prefix\n   configurable with .mailmap, 2006-11-25)\n2. fa375c7f1b6 (Add git-shortlog perl script, 2005-06-04)\n3. https://lore.kernel.org/lkml/\n4. https://lore.kernel.org/lkml/alpine.LFD.1.00.0803161651350.3020@woody.linux-foundation.org/\n5. https://lore.kernel.org/lkml/BANLkTinrbh7Xi27an3uY7pDWrNKhJRYmEA@mail.gmail.com/\n6. https://lore.kernel.org/lkml/CAHk-=wg1+kf1AVzXA-RQX0zjM6t9J2Kay9xyuNqcFHWV-y5ZYw@mail.gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n\nI wondered what this repo-abbrev thing was while reading thorugh\nrecent mailmap.c traffic. I was a bit on the fence about this being a\nRFC/PATCH, but I guess if people hate this & want to keep it that's\nfine, but if not this should be ready for inclusion.\n\nSurely has some conflicts with brian's recent submission, but I wanted\nto get it out of my queue sooner than later.\n\n builtin/blame.c         |  2 +-\n builtin/check-mailmap.c |  2 +-\n builtin/commit.c        |  2 +-\n builtin/log.c           |  2 +-\n builtin/shortlog.c      | 16 ++------------\n mailmap.c               | 47 ++++++++++-------------------------------\n mailmap.h               |  2 +-\n pretty.c                |  2 +-\n shortlog.h              |  1 -\n 9 files changed, 19 insertions(+), 57 deletions(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 6f7e32411a8..712ae8e7425 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -1151,7 +1151,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)\n \tsb.xdl_opts = xdl_opts;\n \tsb.no_whole_file_rename = no_whole_file_rename;\n \n-\tread_mailmap(&mailmap, NULL);\n+\tread_mailmap(&mailmap);\n \n \tsb.found_guilty_entry = &found_guilty_entry;\n \tsb.found_guilty_entry_data = &pi;\ndiff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c\nindex cdce144f3b7..7dc47e47932 100644\n--- a/builtin/check-mailmap.c\n+++ b/builtin/check-mailmap.c\n@@ -47,7 +47,7 @@ int cmd_check_mailmap(int argc, const char **argv, const char *prefix)\n \tif (argc == 0 && !use_stdin)\n \t\tdie(_(\"no contacts specified\"));\n \n-\tread_mailmap(&mailmap, NULL);\n+\tread_mailmap(&mailmap);\n \n \tfor (i = 0; i < argc; ++i)\n \t\tcheck_mailmap(&mailmap, argv[i]);\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 505fe60956d..739110c5a7f 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1039,7 +1039,7 @@ static const char *find_author_by_nickname(const char *name)\n \tav[++ac] = NULL;\n \tsetup_revisions(ac, av, &revs, NULL);\n \trevs.mailmap = &mailmap;\n-\tread_mailmap(revs.mailmap, NULL);\n+\tread_mailmap(revs.mailmap);\n \n \tif (prepare_revision_walk(&revs))\n \t\tdie(_(\"revision walk setup failed\"));\ndiff --git a/builtin/log.c b/builtin/log.c\nindex bd6ff4f9f95..4ee81bc976d 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -230,7 +230,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,\n \n \tif (mailmap) {\n \t\trev->mailmap = xcalloc(1, sizeof(struct string_list));\n-\t\tread_mailmap(rev->mailmap, NULL);\n+\t\tread_mailmap(rev->mailmap);\n \t}\n \n \tif (rev->pretty_given && rev->commit_format == CMIT_FMT_RAW) {\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex c52e4ccd19a..e7c21ab6201 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -61,8 +61,7 @@ static void insert_one_record(struct shortlog *log,\n \tif (log->summary)\n \t\titem->util = (void *)(UTIL_TO_INT(item) + 1);\n \telse {\n-\t\tconst char *dot3 = log->common_repo_prefix;\n-\t\tchar *buffer, *p;\n+\t\tchar *buffer;\n \t\tstruct strbuf subject = STRBUF_INIT;\n \t\tconst char *eol;\n \n@@ -82,17 +81,6 @@ static void insert_one_record(struct shortlog *log,\n \t\tformat_subject(&subject, oneline, \" \");\n \t\tbuffer = strbuf_detach(&subject, NULL);\n \n-\t\tif (dot3) {\n-\t\t\tint dot3len = strlen(dot3);\n-\t\t\tif (dot3len > 5) {\n-\t\t\t\twhile ((p = strstr(buffer, dot3)) != NULL) {\n-\t\t\t\t\tint taillen = strlen(p) - dot3len;\n-\t\t\t\t\tmemcpy(p, \"/.../\", 5);\n-\t\t\t\t\tmemmove(p + 5, p + dot3len, taillen + 1);\n-\t\t\t\t}\n-\t\t\t}\n-\t\t}\n-\n \t\tif (item->util == NULL)\n \t\t\titem->util = xcalloc(1, sizeof(struct string_list));\n \t\tstring_list_append(item->util, buffer);\n@@ -342,7 +330,7 @@ void shortlog_init(struct shortlog *log)\n {\n \tmemset(log, 0, sizeof(*log));\n \n-\tread_mailmap(&log->mailmap, &log->common_repo_prefix);\n+\tread_mailmap(&log->mailmap);\n \n \tlog->list.strdup_strings = 1;\n \tlog->wrap = DEFAULT_WRAPLEN;\ndiff --git a/mailmap.c b/mailmap.c\nindex 962fd86d6d7..f1da233adb9 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -143,31 +143,10 @@ static char *parse_name_and_email(char *buffer, char **name,\n \treturn (*right == '\\0' ? NULL : right);\n }\n \n-static void read_mailmap_line(struct string_list *map, char *buffer,\n-\t\t\t      char **repo_abbrev)\n+static void read_mailmap_line(struct string_list *map, char *buffer)\n {\n \tchar *name1 = NULL, *email1 = NULL, *name2 = NULL, *email2 = NULL;\n-\tif (buffer[0] == '#') {\n-\t\tstatic const char abbrev[] = \"# repo-abbrev:\";\n-\t\tint abblen = sizeof(abbrev) - 1;\n-\t\tint len = strlen(buffer);\n \n-\t\tif (!repo_abbrev)\n-\t\t\treturn;\n-\n-\t\tif (len && buffer[len - 1] == '\\n')\n-\t\t\tbuffer[--len] = 0;\n-\t\tif (!strncmp(buffer, abbrev, abblen)) {\n-\t\t\tchar *cp;\n-\n-\t\t\tfree(*repo_abbrev);\n-\n-\t\t\tfor (cp = buffer + abblen; isspace(*cp); cp++)\n-\t\t\t\t; /* nothing */\n-\t\t\t*repo_abbrev = xstrdup(cp);\n-\t\t}\n-\t\treturn;\n-\t}\n \tif ((name2 = parse_name_and_email(buffer, &name1, &email1, 0)) != NULL)\n \t\tparse_name_and_email(name2, &name2, &email2, 1);\n \n@@ -175,8 +154,7 @@ static void read_mailmap_line(struct string_list *map, char *buffer,\n \t\tadd_mapping(map, name1, email1, name2, email2);\n }\n \n-static int read_mailmap_file(struct string_list *map, const char *filename,\n-\t\t\t     char **repo_abbrev)\n+static int read_mailmap_file(struct string_list *map, const char *filename)\n {\n \tchar buffer[1024];\n \tFILE *f;\n@@ -192,13 +170,12 @@ static int read_mailmap_file(struct string_list *map, const char *filename,\n \t}\n \n \twhile (fgets(buffer, sizeof(buffer), f) != NULL)\n-\t\tread_mailmap_line(map, buffer, repo_abbrev);\n+\t\tread_mailmap_line(map, buffer);\n \tfclose(f);\n \treturn 0;\n }\n \n-static void read_mailmap_string(struct string_list *map, char *buf,\n-\t\t\t\tchar **repo_abbrev)\n+static void read_mailmap_string(struct string_list *map, char *buf)\n {\n \twhile (*buf) {\n \t\tchar *end = strchrnul(buf, '\\n');\n@@ -206,14 +183,12 @@ static void read_mailmap_string(struct string_list *map, char *buf,\n \t\tif (*end)\n \t\t\t*end++ = '\\0';\n \n-\t\tread_mailmap_line(map, buf, repo_abbrev);\n+\t\tread_mailmap_line(map, buf);\n \t\tbuf = end;\n \t}\n }\n \n-static int read_mailmap_blob(struct string_list *map,\n-\t\t\t     const char *name,\n-\t\t\t     char **repo_abbrev)\n+static int read_mailmap_blob(struct string_list *map, const char *name)\n {\n \tstruct object_id oid;\n \tchar *buf;\n@@ -231,13 +206,13 @@ static int read_mailmap_blob(struct string_list *map,\n \tif (type != OBJ_BLOB)\n \t\treturn error(\"mailmap is not a blob: %s\", name);\n \n-\tread_mailmap_string(map, buf, repo_abbrev);\n+\tread_mailmap_string(map, buf);\n \n \tfree(buf);\n \treturn 0;\n }\n \n-int read_mailmap(struct string_list *map, char **repo_abbrev)\n+int read_mailmap(struct string_list *map)\n {\n \tint err = 0;\n \n@@ -247,10 +222,10 @@ int read_mailmap(struct string_list *map, char **repo_abbrev)\n \tif (!git_mailmap_blob && is_bare_repository())\n \t\tgit_mailmap_blob = \"HEAD:.mailmap\";\n \n-\terr |= read_mailmap_file(map, \".mailmap\", repo_abbrev);\n+\terr |= read_mailmap_file(map, \".mailmap\");\n \tif (startup_info->have_repository)\n-\t\terr |= read_mailmap_blob(map, git_mailmap_blob, repo_abbrev);\n-\terr |= read_mailmap_file(map, git_mailmap_file, repo_abbrev);\n+\t\terr |= read_mailmap_blob(map, git_mailmap_blob);\n+\terr |= read_mailmap_file(map, git_mailmap_file);\n \treturn err;\n }\n \ndiff --git a/mailmap.h b/mailmap.h\nindex d0e65646cb5..7e99fccb46c 100644\n--- a/mailmap.h\n+++ b/mailmap.h\n@@ -3,7 +3,7 @@\n \n struct string_list;\n \n-int read_mailmap(struct string_list *map, char **repo_abbrev);\n+int read_mailmap(struct string_list *map);\n void clear_mailmap(struct string_list *map);\n \n int map_user(struct string_list *map,\ndiff --git a/pretty.c b/pretty.c\nindex 7a7708a0ea7..fe0a66623e3 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -679,7 +679,7 @@ static int mailmap_name(const char **email, size_t *email_len,\n \tstatic struct string_list *mail_map;\n \tif (!mail_map) {\n \t\tmail_map = xcalloc(1, sizeof(*mail_map));\n-\t\tread_mailmap(mail_map, NULL);\n+\t\tread_mailmap(mail_map);\n \t}\n \treturn mail_map->nr && map_user(mail_map, email, email_len, name, name_len);\n }\ndiff --git a/shortlog.h b/shortlog.h\nindex 64be879b241..3f7e9aabcae 100644\n--- a/shortlog.h\n+++ b/shortlog.h\n@@ -23,7 +23,6 @@ struct shortlog {\n \t} groups;\n \tstruct string_list trailers;\n \n-\tchar *common_repo_prefix;\n \tint email;\n \tstruct string_list mailmap;\n \tFILE *file;\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"413476","messageId":"CAHk-=wixHyBKZVUcxq+NCWMbkrX0xnppb7UCopRWw1+oExYpYw@mail.gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"Re: [PATCH] shortlog: remove unused(?) \"repo-abbrev\" feature","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2021-01-05T19:18:03Z","receivedAt":"2021-01-05T19:20:33Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"On Tue, Jan 5, 2021 at 5:04 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n>\n> Remove support for the magical \"repo-abbrev\" comment in .mailmap\n> files. This was added to .mailmap parsing in [1], as a generalized\n> feature of the git-shortlog Perl script added earlier in [2].\n\nAck. As you found out, I haven't used this in ages.\n\n           Linus\n"},{"id":"413509","messageId":"CAN0heSoKYWXqskCR=GPreSHc6twCSo1345WTmiPdrR57XSShhA@mail.gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"Re: [PATCH] shortlog: remove unused(?) \"repo-abbrev\" feature","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2021-01-05T21:15:35Z","receivedAt":"2021-01-05T21:16:29Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"Hi Ævar,\n\nOn Tue, 5 Jan 2021 at 14:32, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n>  {\n>         char *name1 = NULL, *email1 = NULL, *name2 = NULL, *email2 = NULL;\n> -       if (buffer[0] == '#') {\n> -               static const char abbrev[] = \"# repo-abbrev:\";\n> -               int abblen = sizeof(abbrev) - 1;\n> -               int len = strlen(buffer);\n>\n> -               if (!repo_abbrev)\n> -                       return;\n> -\n> -               if (len && buffer[len - 1] == '\\n')\n> -                       buffer[--len] = 0;\n> -               if (!strncmp(buffer, abbrev, abblen)) {\n> -                       char *cp;\n> -\n> -                       free(*repo_abbrev);\n> -\n> -                       for (cp = buffer + abblen; isspace(*cp); cp++)\n> -                               ; /* nothing */\n> -                       *repo_abbrev = xstrdup(cp);\n> -               }\n> -               return;\n> -       }\n>         if ((name2 = parse_name_and_email(buffer, &name1, &email1, 0)) != NULL)\n>                 parse_name_and_email(name2, &name2, &email2, 1);\n\nI think this is a tiny bit too aggressive -- it stops recognizing and\nskipping comments. For example, this whitespace-damaged diff:\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 586c3a86b1..4d461ad343 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -373,6 +373,7 @@ test_expect_success 'Shortlog output (complex mapping)' '\n        echo \"Committed <$GIT_COMMITTER_EMAIL>\" > internal_mailmap/.mailmap &&\n        echo \"<cto@company.xx>\n<cto@coompany.xx>\" >> internal_mailmap/.mailmap &&\n        echo \"Some Dude <some@dude.xx>         nick1\n<bugs@company.xx>\" >> internal_mailmap/.mailmap &&\n+       echo \"# Comment <no@mail.xx>         nick1 <bugs@company.xx>\"\n>> internal_mailmap/.mailmap &&\n        echo \"Other Author <other@author.xx>   nick2\n<bugs@company.xx>\" >> internal_mailmap/.mailmap &&\n        echo \"Other Author <other@author.xx>\n<nick2@company.xx>\" >> internal_mailmap/.mailmap &&\n        echo \"Santa Claus <santa.claus@northpole.xx> <me@company.xx>\"\n>> internal_mailmap/.mailmap &&\n\n... which passes before this, makes the test fail after this patch. It\nseems our test coverage for comments is basically zero here. It might\nmake sense to first introduce some testing around comments (maybe not in\nthis \"complex mapping\" test, though) before doing this patch you're\nposting here, but keeping something like\n\n       if (buffer[0] == '#')\n               return;\n\nMartin\n"},{"id":"413512","messageId":"xmqqlfd7x9tr.fsf@gitster.c.googlers.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"Re: [PATCH] shortlog: remove unused(?) \"repo-abbrev\" feature","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-05T23:06:40Z","receivedAt":"2021-01-05T23:07:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> Remove support for the magical \"repo-abbrev\" comment in .mailmap\n> files. This was added to .mailmap parsing in [1], as a generalized\n> feature of the git-shortlog Perl script added earlier in [2].\n> ...\n> I wondered what this repo-abbrev thing was while reading thorugh\n> recent mailmap.c traffic. I was a bit on the fence about this being a\n> RFC/PATCH, but I guess if people hate this & want to keep it that's\n> fine, but if not this should be ready for inclusion.\n>\n> Surely has some conflicts with brian's recent submission, but I wanted\n> to get it out of my queue sooner than later.\n\nI'd expect that nobody would say anything until this change hits a\nreleased version, and then after another release or two when it hits a\nbinary-packaged distro release, we may hear a regression report.  \n\nOr perhaps not.\n\nIn other words, we won't see a complaint (other than any obvious ones\nwe'd notice during review, like \"shouldn't we be skipping comments?\")\nby cooking this in 'next', so I'd prefer to fast-track a topic like this\nquickly to 'master' but make sure we can revert it anytime.  Which in\nturn means that it would be nice to see it while the codepaths involved\nis expected to be quiet for a while.  So, let's ignore this topic while\nthe other mailmap topic is in flight and then revisit it after it\ngraduates to 'master'.\n\nThanks.\n"},{"id":"414200","messageId":"20210112201806.13284-21-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 20/22] mailmap tests: add tests for empty \"<>\" syntax","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:18:04Z","receivedAt":"2021-01-12T21:38:04Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add tests for mailmap's handling of \"<>\", which is allowed on the RHS,\nbut not the LHS of a \"<LHS> <RHS>\" pair.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t4203-mailmap.sh | 27 +++++++++++++++++++++++++++\n 1 file changed, 27 insertions(+)\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 4f61655c04..f19736fef1 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -838,4 +838,31 @@ test_expect_success 'whitespace syntax: setup' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'empty syntax: setup' '\n+\ttest_create_repo empty &&\n+\ttest_commit -C empty --author \"A <>\" A &&\n+\ttest_commit -C empty --author \"B <b@example.com>\" B &&\n+\ttest_commit -C empty --author \"C <c@example.com>\" C &&\n+\n+\ttest_config -C empty mailmap.file ../empty.map &&\n+\tcat >>empty.map <<-\\EOF &&\n+\tAh <ah@example.com> <>\n+\tBee <bee@example.com> <>\n+\tCee <> <c@example.com>\n+\tEOF\n+\n+\tcat >expect <<-\\EOF &&\n+\tAuthor A <> maps to Bee <bee@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor B <b@example.com> maps to B <b@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor C <c@example.com> maps to C <c@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\tEOF\n+\tgit -C empty log --reverse --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 test_done\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414205","messageId":"20210112201806.13284-20-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 19/22] mailmap tests: add tests for whitespace syntax","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:18:03Z","receivedAt":"2021-01-12T21:41:59Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add tests for mailmap's handling of whitespace, i.e. how it trims\nspace within \"<>\" and around author names.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t4203-mailmap.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 52 insertions(+)\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 10e672e006..4f61655c04 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -786,4 +786,56 @@ test_expect_success 'comment syntax: setup' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'whitespace syntax: setup' '\n+\ttest_create_repo space &&\n+\ttest_commit -C space --author \"A <a@example.com>\" A &&\n+\ttest_commit -C space --author \"B <b@example.com>\" B &&\n+\ttest_commit -C space --author \" C <c@example.com>\" C &&\n+\ttest_commit -C space --author \" D  <d@example.com>\" D &&\n+\ttest_commit -C space --author \"E E <e@example.com>\" E &&\n+\ttest_commit -C space --author \"F  F <f@example.com>\" F &&\n+\ttest_commit -C space --author \"G   G <g@example.com>\" G &&\n+\ttest_commit -C space --author \"H   H <h@example.com>\" H &&\n+\n+\ttest_config -C space mailmap.file ../space.map &&\n+\tcat >>space.map <<-\\EOF &&\n+\tAh <ah@example.com> < a@example.com >\n+\tBee <bee@example.com  > <  b@example.com  >\n+\tCee <cee@example.com> C <c@example.com>\n+\tdee <dee@example.com>  D  <d@example.com>\n+\teee <eee@example.com> E E <e@example.com>\n+\teff <eff@example.com> F  F <f@example.com>\n+\tgee <gee@example.com> G   G <g@example.com>\n+\taitch <aitch@example.com> H  H <h@example.com>\n+\tEOF\n+\n+\tcat >expect <<-\\EOF &&\n+\tAuthor A <a@example.com> maps to A <a@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor B <b@example.com> maps to B <b@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor C <c@example.com> maps to Cee <cee@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor D <d@example.com> maps to dee <dee@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor E E <e@example.com> maps to eee <eee@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor F  F <f@example.com> maps to eff <eff@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor G   G <g@example.com> maps to gee <gee@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor H   H <h@example.com> maps to H   H <h@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\tEOF\n+\tgit -C space log --reverse --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 test_done\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414207","messageId":"20210112201806.13284-22-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 21/22] mailmap doc + tests: document and test for case-insensitivity","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:18:05Z","receivedAt":"2021-01-12T21:42:39Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add documentation and more tests for case-insensitivity. The existing\ntest only matched on the E-Mail part, but as shown here we also match\nthe name with strcasecmp().\n\nThis behavior was last discussed on the mailing list in the thread\nstarting at [1]. It seems we're keeping it like this, so let's\ndocument it.\n\n1. https://lore.kernel.org/git/87czykvg19.fsf@evledraar.gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Documentation/gitmailmap.txt |  5 +++++\n t/t4203-mailmap.sh           | 14 ++++++++++++++\n 2 files changed, 19 insertions(+)\n\ndiff --git a/Documentation/gitmailmap.txt b/Documentation/gitmailmap.txt\nindex 55dfebd1b1..7f1089786d 100644\n--- a/Documentation/gitmailmap.txt\n+++ b/Documentation/gitmailmap.txt\n@@ -49,6 +49,11 @@ commit matching the specified commit email address, and:\n which allows mailmap to replace both the name and the email of a\n commit matching both the specified commit name and email address.\n \n+Both E-Mails and names are matched case-insensitively. For example\n+this would also match the 'Commit Name <commit@email.xx>' above:\n+--\n+Proper Name <proper@email.xx> CoMmIt NaMe <CoMmIt@EmAiL.xX>\n+--\n \n EXAMPLES\n --------\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex f19736fef1..89cb300f28 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -220,7 +220,21 @@ test_expect_success 'name entry after email entry, case-insensitive' '\n \t      initial\n \n \tEOF\n+\tgit shortlog HEAD >actual &&\n+\ttest_cmp expect actual &&\n+\n+\tcat >internal.map <<-\\EOF &&\n+\tNiCk <BuGs@CoMpAnY.Xy> NICK1 <BUGS@COMPANY.XX>\n+\tEOF\n+\n+\tcat >expect <<-\\EOF &&\n+\tNiCk (1):\n+\t      second\n+\n+\tRepo Guy (1):\n+\t      initial\n \n+\tEOF\n \tgit shortlog HEAD >actual &&\n \ttest_cmp expect actual\n '\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414208","messageId":"20210112201806.13284-23-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 22/22] shortlog: remove unused(?) \"repo-abbrev\" feature","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:18:06Z","receivedAt":"2021-01-12T21:42:40Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove support for the magical \"repo-abbrev\" comment in .mailmap\nfiles. This was added to .mailmap parsing in [1], as a generalized\nfeature of the git-shortlog Perl script added earlier in [2].\n\nThere was no documentation or tests for this feature, and I don't\nthink it's used in practice anymore.\n\nWhat it did was to allow you to specify a single string to be\nsearch-replaced with \"/.../\" in the .mailmap file. E.g. for\nlinux.git's current .mailmap:\n\n    git archive --remote=git@gitlab.com:linux-kernel/linux.git \\\n        HEAD -- .mailmap | grep -a repo-abbrev\n    # repo-abbrev: /pub/scm/linux/kernel/git/\n\nThen when running e.g.:\n\n    git shortlog --merges --author=Linus -1 v5.10-rc7..v5.10 | grep Merge\n\nWe'd emit (the [...] is mine):\n\n      Merge tag [...]git://git.kernel.org/.../tip/tip\n\nBut will now emit:\n\n      Merge tag [...]git.kernel.org/pub/scm/linux/kernel/git/tip/tip\n\nI think at this point this is just a historical artifact we can get\nrid of. It was initially meant for Linus's own use when we integrated\nthe Perl script[2], but since then it seems he's stopped using it.\n\nDigging through Linus's release announcements on the LKML[3] the last\nrelease I can find that made use of this output is Linux 2.6.25-rc6\nback in March 2008[4]. Later on Linus started using --no-merges[5],\nand nowadays seems to prefer some custom not-quite-shortlog format of\nmerges from lieutenants[6].\n\nYou will still see it on linux.git if you run \"git shortlog\" manually\nyourself with --merges, with this removed you can still get the same\noutput with:\n\n    git log --pretty=fuller v5.10-rc7..v5.10 |\n    sed 's!/pub/scm/linux/kernel/git/!/.../!g' |\n    git shortlog\n\nArguably we should do the same for the search-replacing of \"[PATCH]\"\nat the beginning with \"\". That seems to be another relic of a bygone\nera when linux.git patches would have their E-Mail subject lines\napplied as-is by \"git am\" or whatever. But we documented that feature\nin \"git-shortlog(1)\", and it seems more widely applicable than\nsomething purely kernel-specific.\n\n1. 7595e2ee6ef (git-shortlog: make common repository prefix\n   configurable with .mailmap, 2006-11-25)\n2. fa375c7f1b6 (Add git-shortlog perl script, 2005-06-04)\n3. https://lore.kernel.org/lkml/\n4. https://lore.kernel.org/lkml/alpine.LFD.1.00.0803161651350.3020@woody.linux-foundation.org/\n5. https://lore.kernel.org/lkml/BANLkTinrbh7Xi27an3uY7pDWrNKhJRYmEA@mail.gmail.com/\n6. https://lore.kernel.org/lkml/CAHk-=wg1+kf1AVzXA-RQX0zjM6t9J2Kay9xyuNqcFHWV-y5ZYw@mail.gmail.com/\n\nAcked-by: Linus Torvalds <torvalds@linux-foundation.org>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/blame.c         |  2 +-\n builtin/check-mailmap.c |  2 +-\n builtin/commit.c        |  2 +-\n builtin/log.c           |  2 +-\n builtin/shortlog.c      | 16 ++------------\n mailmap.c               | 48 +++++++++++------------------------------\n mailmap.h               |  2 +-\n pretty.c                |  2 +-\n shortlog.h              |  1 -\n 9 files changed, 21 insertions(+), 56 deletions(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 6f7e32411a..712ae8e742 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -1151,7 +1151,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)\n \tsb.xdl_opts = xdl_opts;\n \tsb.no_whole_file_rename = no_whole_file_rename;\n \n-\tread_mailmap(&mailmap, NULL);\n+\tread_mailmap(&mailmap);\n \n \tsb.found_guilty_entry = &found_guilty_entry;\n \tsb.found_guilty_entry_data = &pi;\ndiff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c\nindex cdce144f3b..7dc47e4793 100644\n--- a/builtin/check-mailmap.c\n+++ b/builtin/check-mailmap.c\n@@ -47,7 +47,7 @@ int cmd_check_mailmap(int argc, const char **argv, const char *prefix)\n \tif (argc == 0 && !use_stdin)\n \t\tdie(_(\"no contacts specified\"));\n \n-\tread_mailmap(&mailmap, NULL);\n+\tread_mailmap(&mailmap);\n \n \tfor (i = 0; i < argc; ++i)\n \t\tcheck_mailmap(&mailmap, argv[i]);\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 505fe60956..739110c5a7 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1039,7 +1039,7 @@ static const char *find_author_by_nickname(const char *name)\n \tav[++ac] = NULL;\n \tsetup_revisions(ac, av, &revs, NULL);\n \trevs.mailmap = &mailmap;\n-\tread_mailmap(revs.mailmap, NULL);\n+\tread_mailmap(revs.mailmap);\n \n \tif (prepare_revision_walk(&revs))\n \t\tdie(_(\"revision walk setup failed\"));\ndiff --git a/builtin/log.c b/builtin/log.c\nindex bd6ff4f9f9..4ee81bc976 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -230,7 +230,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,\n \n \tif (mailmap) {\n \t\trev->mailmap = xcalloc(1, sizeof(struct string_list));\n-\t\tread_mailmap(rev->mailmap, NULL);\n+\t\tread_mailmap(rev->mailmap);\n \t}\n \n \tif (rev->pretty_given && rev->commit_format == CMIT_FMT_RAW) {\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex c52e4ccd19..e7c21ab620 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -61,8 +61,7 @@ static void insert_one_record(struct shortlog *log,\n \tif (log->summary)\n \t\titem->util = (void *)(UTIL_TO_INT(item) + 1);\n \telse {\n-\t\tconst char *dot3 = log->common_repo_prefix;\n-\t\tchar *buffer, *p;\n+\t\tchar *buffer;\n \t\tstruct strbuf subject = STRBUF_INIT;\n \t\tconst char *eol;\n \n@@ -82,17 +81,6 @@ static void insert_one_record(struct shortlog *log,\n \t\tformat_subject(&subject, oneline, \" \");\n \t\tbuffer = strbuf_detach(&subject, NULL);\n \n-\t\tif (dot3) {\n-\t\t\tint dot3len = strlen(dot3);\n-\t\t\tif (dot3len > 5) {\n-\t\t\t\twhile ((p = strstr(buffer, dot3)) != NULL) {\n-\t\t\t\t\tint taillen = strlen(p) - dot3len;\n-\t\t\t\t\tmemcpy(p, \"/.../\", 5);\n-\t\t\t\t\tmemmove(p + 5, p + dot3len, taillen + 1);\n-\t\t\t\t}\n-\t\t\t}\n-\t\t}\n-\n \t\tif (item->util == NULL)\n \t\t\titem->util = xcalloc(1, sizeof(struct string_list));\n \t\tstring_list_append(item->util, buffer);\n@@ -342,7 +330,7 @@ void shortlog_init(struct shortlog *log)\n {\n \tmemset(log, 0, sizeof(*log));\n \n-\tread_mailmap(&log->mailmap, &log->common_repo_prefix);\n+\tread_mailmap(&log->mailmap);\n \n \tlog->list.strdup_strings = 1;\n \tlog->wrap = DEFAULT_WRAPLEN;\ndiff --git a/mailmap.c b/mailmap.c\nindex 962fd86d6d..eb77c6e77c 100644\n--- a/mailmap.c\n+++ b/mailmap.c\n@@ -143,31 +143,13 @@ static char *parse_name_and_email(char *buffer, char **name,\n \treturn (*right == '\\0' ? NULL : right);\n }\n \n-static void read_mailmap_line(struct string_list *map, char *buffer,\n-\t\t\t      char **repo_abbrev)\n+static void read_mailmap_line(struct string_list *map, char *buffer)\n {\n \tchar *name1 = NULL, *email1 = NULL, *name2 = NULL, *email2 = NULL;\n-\tif (buffer[0] == '#') {\n-\t\tstatic const char abbrev[] = \"# repo-abbrev:\";\n-\t\tint abblen = sizeof(abbrev) - 1;\n-\t\tint len = strlen(buffer);\n \n-\t\tif (!repo_abbrev)\n-\t\t\treturn;\n-\n-\t\tif (len && buffer[len - 1] == '\\n')\n-\t\t\tbuffer[--len] = 0;\n-\t\tif (!strncmp(buffer, abbrev, abblen)) {\n-\t\t\tchar *cp;\n-\n-\t\t\tfree(*repo_abbrev);\n-\n-\t\t\tfor (cp = buffer + abblen; isspace(*cp); cp++)\n-\t\t\t\t; /* nothing */\n-\t\t\t*repo_abbrev = xstrdup(cp);\n-\t\t}\n+\tif (buffer[0] == '#')\n \t\treturn;\n-\t}\n+\n \tif ((name2 = parse_name_and_email(buffer, &name1, &email1, 0)) != NULL)\n \t\tparse_name_and_email(name2, &name2, &email2, 1);\n \n@@ -175,8 +157,7 @@ static void read_mailmap_line(struct string_list *map, char *buffer,\n \t\tadd_mapping(map, name1, email1, name2, email2);\n }\n \n-static int read_mailmap_file(struct string_list *map, const char *filename,\n-\t\t\t     char **repo_abbrev)\n+static int read_mailmap_file(struct string_list *map, const char *filename)\n {\n \tchar buffer[1024];\n \tFILE *f;\n@@ -192,13 +173,12 @@ static int read_mailmap_file(struct string_list *map, const char *filename,\n \t}\n \n \twhile (fgets(buffer, sizeof(buffer), f) != NULL)\n-\t\tread_mailmap_line(map, buffer, repo_abbrev);\n+\t\tread_mailmap_line(map, buffer);\n \tfclose(f);\n \treturn 0;\n }\n \n-static void read_mailmap_string(struct string_list *map, char *buf,\n-\t\t\t\tchar **repo_abbrev)\n+static void read_mailmap_string(struct string_list *map, char *buf)\n {\n \twhile (*buf) {\n \t\tchar *end = strchrnul(buf, '\\n');\n@@ -206,14 +186,12 @@ static void read_mailmap_string(struct string_list *map, char *buf,\n \t\tif (*end)\n \t\t\t*end++ = '\\0';\n \n-\t\tread_mailmap_line(map, buf, repo_abbrev);\n+\t\tread_mailmap_line(map, buf);\n \t\tbuf = end;\n \t}\n }\n \n-static int read_mailmap_blob(struct string_list *map,\n-\t\t\t     const char *name,\n-\t\t\t     char **repo_abbrev)\n+static int read_mailmap_blob(struct string_list *map, const char *name)\n {\n \tstruct object_id oid;\n \tchar *buf;\n@@ -231,13 +209,13 @@ static int read_mailmap_blob(struct string_list *map,\n \tif (type != OBJ_BLOB)\n \t\treturn error(\"mailmap is not a blob: %s\", name);\n \n-\tread_mailmap_string(map, buf, repo_abbrev);\n+\tread_mailmap_string(map, buf);\n \n \tfree(buf);\n \treturn 0;\n }\n \n-int read_mailmap(struct string_list *map, char **repo_abbrev)\n+int read_mailmap(struct string_list *map)\n {\n \tint err = 0;\n \n@@ -247,10 +225,10 @@ int read_mailmap(struct string_list *map, char **repo_abbrev)\n \tif (!git_mailmap_blob && is_bare_repository())\n \t\tgit_mailmap_blob = \"HEAD:.mailmap\";\n \n-\terr |= read_mailmap_file(map, \".mailmap\", repo_abbrev);\n+\terr |= read_mailmap_file(map, \".mailmap\");\n \tif (startup_info->have_repository)\n-\t\terr |= read_mailmap_blob(map, git_mailmap_blob, repo_abbrev);\n-\terr |= read_mailmap_file(map, git_mailmap_file, repo_abbrev);\n+\t\terr |= read_mailmap_blob(map, git_mailmap_blob);\n+\terr |= read_mailmap_file(map, git_mailmap_file);\n \treturn err;\n }\n \ndiff --git a/mailmap.h b/mailmap.h\nindex d0e65646cb..7e99fccb46 100644\n--- a/mailmap.h\n+++ b/mailmap.h\n@@ -3,7 +3,7 @@\n \n struct string_list;\n \n-int read_mailmap(struct string_list *map, char **repo_abbrev);\n+int read_mailmap(struct string_list *map);\n void clear_mailmap(struct string_list *map);\n \n int map_user(struct string_list *map,\ndiff --git a/pretty.c b/pretty.c\nindex 05eef7fda0..3922f6f9f2 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -679,7 +679,7 @@ static int mailmap_name(const char **email, size_t *email_len,\n \tstatic struct string_list *mail_map;\n \tif (!mail_map) {\n \t\tmail_map = xcalloc(1, sizeof(*mail_map));\n-\t\tread_mailmap(mail_map, NULL);\n+\t\tread_mailmap(mail_map);\n \t}\n \treturn mail_map->nr && map_user(mail_map, email, email_len, name, name_len);\n }\ndiff --git a/shortlog.h b/shortlog.h\nindex 64be879b24..3f7e9aabca 100644\n--- a/shortlog.h\n+++ b/shortlog.h\n@@ -23,7 +23,6 @@ struct shortlog {\n \t} groups;\n \tstruct string_list trailers;\n \n-\tchar *common_repo_prefix;\n \tint email;\n \tstruct string_list mailmap;\n \tFILE *file;\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414209","messageId":"20210112201806.13284-17-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 16/22] tests: refactor a few tests to use \"test_commit --append\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:18:00Z","receivedAt":"2021-01-12T21:42:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Refactor a few more tests to use the new \"--append\" option to\n\"test_commit\". I added it for use in the mailmap tests, but this\ndemonstrates how useful it is in general.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t1412-reflog-loop.sh   |  7 ++-----\n t/t2012-checkout-last.sh | 12 +++---------\n t/t7810-grep.sh          | 18 +++---------------\n 3 files changed, 8 insertions(+), 29 deletions(-)\n\ndiff --git a/t/t1412-reflog-loop.sh b/t/t1412-reflog-loop.sh\nindex 3acd895afb..977603f7f1 100755\n--- a/t/t1412-reflog-loop.sh\n+++ b/t/t1412-reflog-loop.sh\n@@ -4,11 +4,8 @@ test_description='reflog walk shows repeated commits again'\n . ./test-lib.sh\n \n test_expect_success 'setup commits' '\n-\ttest_tick &&\n-\techo content >file && git add file && git commit -m one &&\n-\tgit tag one &&\n-\techo content >>file && git add file && git commit -m two &&\n-\tgit tag two\n+\ttest_commit one file content &&\n+\ttest_commit --append two file content\n '\n \n test_expect_success 'setup reflog with alternating commits' '\ndiff --git a/t/t2012-checkout-last.sh b/t/t2012-checkout-last.sh\nindex e7ba8c505f..c95aa3e78f 100755\n--- a/t/t2012-checkout-last.sh\n+++ b/t/t2012-checkout-last.sh\n@@ -5,13 +5,9 @@ test_description='checkout can switch to last branch and merge base'\n . ./test-lib.sh\n \n test_expect_success 'setup' '\n-\techo hello >world &&\n-\tgit add world &&\n-\tgit commit -m initial &&\n+\ttest_commit initial world hello &&\n \tgit branch other &&\n-\techo \"hello again\" >>world &&\n-\tgit add world &&\n-\tgit commit -m second\n+\ttest_commit --append second world \"hello again\"\n '\n \n test_expect_success '\"checkout -\" does not work initially' '\n@@ -93,9 +89,7 @@ test_expect_success 'switch to twelfth from the last' '\n \n test_expect_success 'merge base test setup' '\n \tgit checkout -b another other &&\n-\techo \"hello again\" >>world &&\n-\tgit add world &&\n-\tgit commit -m third\n+\ttest_commit --append third world \"hello again\"\n '\n \n test_expect_success 'another...master' '\ndiff --git a/t/t7810-grep.sh b/t/t7810-grep.sh\nindex 991d5bd9c0..312e0f8cb4 100755\n--- a/t/t7810-grep.sh\n+++ b/t/t7810-grep.sh\n@@ -687,21 +687,9 @@ test_expect_success 'grep -C1 hunk mark between files' '\n '\n \n test_expect_success 'log grep setup' '\n-\techo a >>file &&\n-\ttest_tick &&\n-\tGIT_AUTHOR_NAME=\"With * Asterisk\" \\\n-\tGIT_AUTHOR_EMAIL=\"xyzzy@frotz.com\" \\\n-\tgit commit -a -m \"second\" &&\n-\n-\techo a >>file &&\n-\ttest_tick &&\n-\tgit commit -a -m \"third\" &&\n-\n-\techo a >>file &&\n-\ttest_tick &&\n-\tGIT_AUTHOR_NAME=\"Night Fall\" \\\n-\tGIT_AUTHOR_EMAIL=\"nitfol@frobozz.com\" \\\n-\tgit commit -a -m \"fourth\"\n+\ttest_commit --append --author \"With * Asterisk <xyzzy@frotz.com>\" second file a &&\n+\ttest_commit --append third file a &&\n+\ttest_commit --append --author \"Night Fall <nitfol@frobozz.com>\" fourth file a\n '\n \n test_expect_success 'log grep (1)' '\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414210","messageId":"20210112201806.13284-16-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 15/22] test-lib functions: add an --append option to test_commit","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:59Z","receivedAt":"2021-01-12T21:42:43Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add an --append option to test_commit to append <contents> to the\n<file> we're writing to. This simplifies a lot of test setup, as shown\nin some of the tests being changed here.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t4203-mailmap.sh      | 39 +++++++--------------------------------\n t/test-lib-functions.sh | 14 +++++++++++++-\n 2 files changed, 20 insertions(+), 33 deletions(-)\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 2b342d7f7c..5d92880a5a 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -5,14 +5,8 @@ test_description='.mailmap configurations'\n . ./test-lib.sh\n \n test_expect_success 'setup commits and contacts file' '\n-\techo one >one &&\n-\tgit add one &&\n-\ttest_tick &&\n-\tgit commit -m initial &&\n-\techo two >>one &&\n-\tgit add one &&\n-\ttest_tick &&\n-\tgit commit --author \"nick1 <bugs@company.xx>\" -m second\n+\ttest_commit initial one one &&\n+\ttest_commit --author \"nick1 <bugs@company.xx>\" --append second one two\n '\n \n test_expect_success 'check-mailmap no arguments' '\n@@ -436,30 +430,11 @@ test_expect_success 'Shortlog output (complex mapping)' '\n \tSanta Claus <santa.claus@northpole.xx> <me@company.xx>\n \tEOF\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-\techo seven >>one &&\n-\tgit add one &&\n-\ttest_tick &&\n-\tgit commit --author \"CTO <cto@coompany.xx>\" -m seventh &&\n+\ttest_commit --author \"nick2 <bugs@company.xx>\" --append third one three &&\n+\ttest_commit --author \"nick2 <nick2@company.xx>\" --append fourth one four &&\n+\ttest_commit --author \"santa <me@company.xx>\" --append fifth one five &&\n+\ttest_commit --author \"claus <me@company.xx>\" --append sixth one six &&\n+\ttest_commit --author \"CTO <cto@coompany.xx>\" --append seventh one seven &&\n \n \tcat >expect <<-EOF &&\n \t$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> (1):\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 529f6264fe..b0a5d74dc7 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -183,6 +183,9 @@ debug () {\n #\tRun all git commands in directory <dir>\n #   --notick\n #\tDo not call test_tick before making a commit\n+#   --append\n+#\tUse \"echo >>\" instead of \"echo >\" when writing \"<contents>\" to\n+#\t\"<file>\"\n #   --signoff\n #\tInvoke \"git commit\" with --signoff\n #   --author=<author>\n@@ -195,6 +198,7 @@ debug () {\n \n test_commit () {\n \tnotick= &&\n+\tappend= &&\n \tauthor= &&\n \tsignoff= &&\n \tindir= &&\n@@ -204,6 +208,9 @@ test_commit () {\n \t\t--notick)\n \t\t\tnotick=yes\n \t\t\t;;\n+\t\t--append)\n+\t\t\tappend=yes\n+\t\t\t;;\n \t\t--author)\n \t\t\tauthor=\"$2\"\n \t\t\tshift\n@@ -223,7 +230,12 @@ test_commit () {\n \tdone &&\n \tindir=${indir:+\"$indir\"/} &&\n \tfile=${2:-\"$1.t\"} &&\n-\techo \"${3-$1}\" > \"$indir$file\" &&\n+\tif test -n \"$append\"\n+\tthen\n+\t\techo \"${3-$1}\" >>\"$indir$file\"\n+\telse\n+\t\techo \"${3-$1}\" >\"$indir$file\"\n+\tfi &&\n \tgit ${indir:+ -C \"$indir\"} add \"$file\" &&\n \tif test -z \"$notick\"\n \tthen\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414211","messageId":"20210112201806.13284-10-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 09/22] mailmap tests: add a test for \"not a blob\" error","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:53Z","receivedAt":"2021-01-12T21:43:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add a test for one of the error conditions added in\n938a60d64f (mailmap: clean up read_mailmap error handling,\n2012-12-12).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t4203-mailmap.sh | 9 +++++++++\n 1 file changed, 9 insertions(+)\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 03a98d9635..78d56e0566 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -333,6 +333,15 @@ test_expect_success 'mailmap.blob can be missing' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'mailmap.blob might be the wrong type' '\n+\ttest_when_finished \"rm .mailmap\" &&\n+\tcp default.map .mailmap &&\n+\n+\tgit -c mailmap.blob=HEAD: shortlog HEAD >actual 2>err &&\n+\ttest_i18ngrep \"mailmap is not a blob\" err &&\n+\ttest_cmp expect actual\n+'\n+\n test_expect_success 'mailmap.blob defaults to off in non-bare repo' '\n \tgit init non-bare &&\n \t(\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414212","messageId":"20210112201806.13284-13-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 12/22] test-lib functions: expand \"test_commit\" comment template","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:56Z","receivedAt":"2021-01-12T21:43:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Expand the comment template for \"test_commit\" to match that of\n\"test_commit_bulk\" added in b1c36cb849 (test-lib: introduce\ntest_commit_bulk, 2019-07-02). It has several undocumented options,\nwhich won't all fit on one line. Follow-up commit(s) will document\nthem.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-functions.sh | 8 +++-----\n 1 file changed, 3 insertions(+), 5 deletions(-)\n\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 999982fe4a..396e039d2a 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -178,16 +178,14 @@ debug () {\n \tGIT_DEBUGGER=\"${GIT_DEBUGGER}\" \"$@\" <&6 >&5 2>&7\n }\n \n-# Call test_commit with the arguments\n-# [-C <directory>] <message> [<file> [<contents> [<tag>]]]\"\n+# Usage: test_commit [options] <message> [<file> [<contents> [<tag>]]]\n+#   -C <dir>:\n+#\tRun all git commands in directory <dir>\n #\n # This will commit a file with the given contents and the given commit\n # message, and tag the resulting commit with the given tag name.\n #\n # <file>, <contents>, and <tag> all default to <message>.\n-#\n-# If the first argument is \"-C\", the second argument is used as a path for\n-# the git invocations.\n \n test_commit () {\n \tnotick= &&\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414213","messageId":"20210112201806.13284-12-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 11/22] mailmap: test for silent exiting on missing file/blob","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:55Z","receivedAt":"2021-01-12T21:43:42Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"That we silently ignore missing mailmap.file or mailmap.blob values is\nintentional. See 938a60d64f (mailmap: clean up read_mailmap error\nhandling, 2012-12-12). However, nothing tested for this. Let's do that\nby checking that stderr is empty in those cases.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t4203-mailmap.sh | 21 ++++++++++++++++++++-\n 1 file changed, 20 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex a42b454756..2b342d7f7c 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -309,6 +309,24 @@ test_expect_success 'mailmap.file overrides mailmap.blob' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'mailmap.file can be missing' '\n+\ttest_when_finished \"rm .mailmap\" &&\n+\tcp default.map .mailmap &&\n+\n+\ttest_config mailmap.file nonexistent &&\n+\tcat >expect <<-\\EOF &&\n+\tRepo Guy (1):\n+\t      initial\n+\n+\tnick1 (1):\n+\t      second\n+\n+\tEOF\n+\tgit shortlog HEAD >actual 2>err &&\n+\ttest_must_be_empty err &&\n+\ttest_cmp expect actual\n+'\n+\n test_expect_success 'mailmap.blob can be missing' '\n \ttest_when_finished \"rm .mailmap\" &&\n \tcp default.map .mailmap &&\n@@ -321,7 +339,8 @@ test_expect_success 'mailmap.blob can be missing' '\n \t      second\n \n \tEOF\n-\tgit -c mailmap.blob=map:nonexistent shortlog HEAD >actual &&\n+\tgit -c mailmap.blob=map:nonexistent shortlog HEAD >actual 2>err &&\n+\ttest_must_be_empty err &&\n \ttest_cmp expect actual\n '\n \n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414214","messageId":"20210112201806.13284-15-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 14/22] test-lib functions: add --author support to test_commit","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:58Z","receivedAt":"2021-01-12T21:43:43Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add support for --author to \"test_commit\". This will simplify some\ncurrent and future tests, one of those is being changed here.\n\nLet's also line-wrap the \"git commit\" command invocation to make diffs\nthat add subsequent options easier to add, as they'll only need to add\na new option line.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t7509-commit-authorship.sh |  7 ++-----\n t/test-lib-functions.sh      | 11 ++++++++++-\n 2 files changed, 12 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t7509-commit-authorship.sh b/t/t7509-commit-authorship.sh\nindex 500ab2fe72..ee6c47416e 100755\n--- a/t/t7509-commit-authorship.sh\n+++ b/t/t7509-commit-authorship.sh\n@@ -18,11 +18,8 @@ message_body () {\n }\n \n test_expect_success '-C option copies authorship and message' '\n-\techo \"Initial\" >foo &&\n-\tgit add foo &&\n-\ttest_tick &&\n-\tgit commit -m \"Initial Commit\" --author Frigate\\ \\<flying@over.world\\> &&\n-\tgit tag Initial &&\n+\ttest_commit --author Frigate\\ \\<flying@over.world\\> \\\n+\t\t\"Initial Commit\" foo Initial Initial &&\n \techo \"Test 1\" >>foo &&\n \ttest_tick &&\n \tgit commit -a -C Initial &&\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 194b601bc0..529f6264fe 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -185,6 +185,8 @@ debug () {\n #\tDo not call test_tick before making a commit\n #   --signoff\n #\tInvoke \"git commit\" with --signoff\n+#   --author=<author>\n+#\tInvoke \"git commit\" with --author=<author>\n #\n # This will commit a file with the given contents and the given commit\n # message, and tag the resulting commit with the given tag name.\n@@ -193,6 +195,7 @@ debug () {\n \n test_commit () {\n \tnotick= &&\n+\tauthor= &&\n \tsignoff= &&\n \tindir= &&\n \twhile test $# != 0\n@@ -201,6 +204,10 @@ test_commit () {\n \t\t--notick)\n \t\t\tnotick=yes\n \t\t\t;;\n+\t\t--author)\n+\t\t\tauthor=\"$2\"\n+\t\t\tshift\n+\t\t\t;;\n \t\t--signoff)\n \t\t\tsignoff=\"$1\"\n \t\t\t;;\n@@ -222,7 +229,9 @@ test_commit () {\n \tthen\n \t\ttest_tick\n \tfi &&\n-\tgit ${indir:+ -C \"$indir\"} commit $signoff -m \"$1\" &&\n+\tgit ${indir:+ -C \"$indir\"} commit \\\n+\t    ${author:+ --author \"$author\"} \\\n+\t    $signoff -m \"$1\" &&\n \tgit ${indir:+ -C \"$indir\"} tag \"${4:-$1}\"\n }\n \n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414215","messageId":"20210112201806.13284-14-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 13/22] test-lib functions: document arguments to test_commit","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:57Z","receivedAt":"2021-01-12T21:43:44Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The --notick argument was added in [1] and was followed by --signoff\nin [2], but neither of these commits added any documentation for these\noptions. When -C was added in [3] a comment was added to document it,\nbut not the other options. Let's document all of these options.\n\n1. 44b85e89d7 (t7003: add test to filter a branch with a commit at\n   epoch, 2012-07-12),\n2. 5ed75e2a3f (cherry-pick: don't forget -s on failure, 2012-09-14).\n3. 6f94351b0a (test-lib-functions.sh: teach test_commit -C <dir>,\n   2016-12-08)\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-functions.sh | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 396e039d2a..194b601bc0 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -181,6 +181,10 @@ debug () {\n # Usage: test_commit [options] <message> [<file> [<contents> [<tag>]]]\n #   -C <dir>:\n #\tRun all git commands in directory <dir>\n+#   --notick\n+#\tDo not call test_tick before making a commit\n+#   --signoff\n+#\tInvoke \"git commit\" with --signoff\n #\n # This will commit a file with the given contents and the given commit\n # message, and tag the resulting commit with the given tag name.\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414216","messageId":"20210112201806.13284-11-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 10/22] mailmap tests: get rid of overly complex blame fuzzing","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:54Z","receivedAt":"2021-01-12T21:43:45Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change a test that used a custom fuzzing function since\nbfdfa3d414 (t4203 (mailmap): stop hardcoding commit ids and dates,\n2010-10-15) to just use the \"blame --porcelain\" output instead.\n\nWe could use the same pattern as 0ba9c9a0fb (t8008: rely on\nrev-parse'd HEAD instead of sha1 value, 2017-07-26) does to do this,\nbut there wouldn't be any point. We're not trying to test \"blame\"\noutput here in general, just that \"blame\" pays attention to the\nmailmap.\n\nSo it's sufficient to get the blamed line(s) and authors from the\noutput, which is much easier with the \"--porcelain\" option.\n\nIt would still be possible for there to be a bug in \"blame\" such that\nit uses the mailmap for its \"--porcelain\" output, but not the regular\noutput. Let's test for that simply by checking if specifying the\nmailmap changes the output.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t4203-mailmap.sh | 50 +++++++++++++++++++++++++++-------------------\n 1 file changed, 30 insertions(+), 20 deletions(-)\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 78d56e0566..a42b454756 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -4,14 +4,6 @@ test_description='.mailmap configurations'\n \n . ./test-lib.sh\n \n-fuzz_blame () {\n-\tsed \"\n-\t\ts/$_x05[0-9a-f][0-9a-f][0-9a-f]/OBJID/g\n-\t\ts/$_x05[0-9a-f][0-9a-f]/OBJI/g\n-\t\ts/[-0-9]\\{10\\} [:0-9]\\{8\\} [-+][0-9]\\{4\\}/DATE/g\n-\t\" \"$@\"\n-}\n-\n test_expect_success 'setup commits and contacts file' '\n \techo one >one &&\n \tgit add one &&\n@@ -630,24 +622,42 @@ test_expect_success 'Only grep replaced author with --use-mailmap' '\n \ttest_must_be_empty actual\n '\n \n-test_expect_success 'Blame output (complex mapping)' '\n+test_expect_success 'Blame --porcelain output (complex mapping)' '\n \ttest_config mailmap.file complex.map &&\n \n \tcat >expect <<-EOF &&\n-\t^OBJI ($GIT_AUTHOR_NAME     DATE 1) one\n-\tOBJID (Some Dude    DATE 2) two\n-\tOBJID (Other Author DATE 3) three\n-\tOBJID (Other Author DATE 4) four\n-\tOBJID (Santa Claus  DATE 5) five\n-\tOBJID (Santa Claus  DATE 6) six\n-\tOBJID (CTO          DATE 7) seven\n-\tEOF\n-\n-\tgit blame one >actual &&\n-\tfuzz_blame actual >actual.fuzz &&\n+\t1 1 1\n+\tA U Thor\n+\t2 2 1\n+\tSome Dude\n+\t3 3 1\n+\tOther Author\n+\t4 4 1\n+\tOther Author\n+\t5 5 1\n+\tSanta Claus\n+\t6 6 1\n+\tSanta Claus\n+\t7 7 1\n+\tCTO\n+\tEOF\n+\n+\tgit blame --porcelain one >actual.blame &&\n+\tgrep -E \\\n+\t\t-e \"[0-9]+ [0-9]+ [0-9]+$\" \\\n+\t\t-e \"^author .*$\" \\\n+\t\tactual.blame >actual.grep &&\n+\tcut -d \" \" -f2-4 <actual.grep >actual.fuzz &&\n \ttest_cmp expect actual.fuzz\n '\n \n+test_expect_success 'Blame output (complex mapping)' '\n+\tgit -c mailmap.file=complex.map blame one >a &&\n+\tgit blame one >b &&\n+\ttest_file_not_empty a &&\n+\t! cmp a b\n+'\n+\n test_expect_success 'commit --author honors mailmap' '\n \ttest_config mailmap.file complex.map &&\n \n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414217","messageId":"20210112201806.13284-9-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 08/22] mailmap tests: remove redundant entry in test","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:52Z","receivedAt":"2021-01-12T21:43:46Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove a redundant line in a test added in d20d654fe8 (Change current\nmailmap usage to do matching on both name and email of\nauthor/committer., 2009-02-08).\n\nThis didn't conceivably test anything useful and is most likely a\ncopy/paste error.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t4203-mailmap.sh | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex dbd365681e..03a98d9635 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -414,7 +414,6 @@ test_expect_success 'Shortlog output (complex mapping)' '\n \tOther Author <other@author.xx>   nick2 <bugs@company.xx>\n \tOther Author <other@author.xx>         <nick2@company.xx>\n \tSanta Claus <santa.claus@northpole.xx> <me@company.xx>\n-\tSanta Claus <santa.claus@northpole.xx> <me@company.xx>\n \tEOF\n \n \techo three >>one &&\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414218","messageId":"20210112201806.13284-8-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 07/22] mailmap tests: improve --stdin tests","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:51Z","receivedAt":"2021-01-12T21:43:47Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The --stdin tests setup the \"contact\" file in the main setup, let's\ninstead set it up in the test that uses it.\n\nAlso refactor the first test so it's obvious that the point of it is\nthat \"check-mailmap\" will spew its input as-is when given no\nargument. For that one we can just use the \"expect\" file as-is.\n\nAlso add tests for how other \"--stdin\" cases are handled, e.g. one\nwhere we actually do a mapping.\n\nFor the rest of --stdin testing we just assume we're going to get the\nsame output. We could follow-up and make sure everything's\nround-tripped through both --stdin and the file/blob backends, but I\ndon't think there's much point in that.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t4203-mailmap.sh | 40 ++++++++++++++++++++++++++++++++--------\n 1 file changed, 32 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 61d1b62317..dbd365681e 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -13,11 +13,6 @@ fuzz_blame () {\n }\n \n test_expect_success 'setup commits and contacts file' '\n-\tcat >contacts <<-EOF &&\n-\t$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n-\tnick1 <bugs@company.xx>\n-\tEOF\n-\n \techo one >one &&\n \tgit add one &&\n \ttest_tick &&\n@@ -48,24 +43,53 @@ test_expect_success 'check-mailmap --stdin' '\n \t$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n \tnick1 <bugs@company.xx>\n \tEOF\n-\tgit check-mailmap --stdin <contacts >actual &&\n+\tgit check-mailmap --stdin <expect >actual &&\n \ttest_cmp expect actual\n '\n \n-test_expect_success 'check-mailmap --stdin arguments' '\n+test_expect_success 'check-mailmap --stdin arguments: no mapping' '\n+\ttest_when_finished \"rm contacts\" &&\n+\tcat >contacts <<-EOF &&\n+\t$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n+\tnick1 <bugs@company.xx>\n+\tEOF\n \tcat >expect <<-\\EOF &&\n \tInternal Guy <bugs@company.xy>\n \tEOF\n-\tcat <contacts >>expect &&\n+\tcat contacts >>expect &&\n+\n \tgit check-mailmap --stdin \"Internal Guy <bugs@company.xy>\" \\\n \t\t<contacts >actual &&\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'check-mailmap --stdin arguments: mapping' '\n+\ttest_when_finished \"rm .mailmap\" &&\n+\tcat >.mailmap <<-EOF &&\n+\tNew Name <$GIT_AUTHOR_EMAIL>\n+\tEOF\n+\tcat >stdin <<-EOF &&\n+\tOld Name <$GIT_AUTHOR_EMAIL>\n+\tEOF\n+\n+\tcp .mailmap expect &&\n+\tgit check-mailmap --stdin <stdin >actual &&\n+\ttest_cmp expect actual &&\n+\n+\tcat .mailmap >>expect &&\n+\tgit check-mailmap --stdin \"Another Old Name <$GIT_AUTHOR_EMAIL>\" \\\n+\t\t<stdin >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_expect_success 'check-mailmap bogus contact' '\n \ttest_must_fail git check-mailmap bogus\n '\n \n+test_expect_success 'check-mailmap bogus contact --stdin' '\n+\ttest_must_fail git check-mailmap --stdin bogus </dev/null\n+'\n+\n test_expect_success 'No mailmap' '\n \tcat >expect <<-EOF &&\n \t$GIT_AUTHOR_NAME (1):\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414219","messageId":"20210112201806.13284-18-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 17/22] mailmap doc + tests: add better examples & test them","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:18:01Z","receivedAt":"2021-01-12T21:43:48Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the mailmap documentation added in 0925ce4d49 (Add map_user()\nand clear_mailmap() to mailmap, 2009-02-08) to continue discussing the\nJane/Joe example. I think this makes things a lot less confusing as\nwe're building up more complex examples using one set of data which\ncovers all the things we'd like to discuss.\n\nAlso add tests to assert that what our documentation says is what's\nactually happening. This is mostly (or entirely) covered by existing\ntests which I'm not deleting, but having these tests for the synopsis\nmakes it easier to follow-along while reading the tests & docs.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Documentation/gitmailmap.txt | 49 ++++++++++++--------\n t/t4203-mailmap.sh           | 88 ++++++++++++++++++++++++++++++++++++\n 2 files changed, 117 insertions(+), 20 deletions(-)\n\ndiff --git a/Documentation/gitmailmap.txt b/Documentation/gitmailmap.txt\nindex 4e4677018b..55dfebd1b1 100644\n--- a/Documentation/gitmailmap.txt\n+++ b/Documentation/gitmailmap.txt\n@@ -53,7 +53,7 @@ commit matching both the specified commit name and email address.\n EXAMPLES\n --------\n \n-Example 1: Your history contains commits by two authors, Jane\n+Your history contains commits by two authors, Jane\n and Joe, whose names appear in the repository under several forms:\n \n ------------\n@@ -65,36 +65,45 @@ Jane D. <jane@desktop.(none)>\n ------------\n \n Now suppose that Joe wants his middle name initial used, and Jane\n-prefers her family name fully spelled out. A proper `.mailmap` file\n-would look like:\n+prefers her family name fully spelled out. A `.mailmap` file to\n+correct the names would look like:\n \n ------------\n-Jane Doe         <jane@desktop.(none)>\n Joe R. Developer <joe@example.com>\n+Jane Doe <jane@example.com>\n+Jane Doe <jane@desktop.(none)>\n ------------\n \n-Note how there is no need for an entry for `<jane@laptop.(none)>`, because the\n-real name of that author is already correct.\n+Note that there's no need to map the name for 'jane@laptop.(none)' to\n+only correct the names. However, leaving the obviously broken\n+`<jane@laptop.(none)>' and '<jane@desktop.(none)>' E-Mails as-is is\n+usually not what you want. A `.mailmap` file which also corrects those\n+is:\n \n-Example 2: Your repository contains commits from the following\n-authors:\n+------------\n+Joe R. Developer <joe@example.com>\n+Jane Doe <jane@example.com> <jane@laptop.(none)>\n+Jane Doe <jane@example.com> <jane@desktop.(none)>\n+------------\n+\n+Finally, let's say that Joe and Jane shared an E-Mail address, but not\n+a name, e.g. by having these two commits in the history generated by a\n+bug reporting system. I.e. names appearing in history as:\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-CTO <cto@coompany.xx>\n+Joe <bugs@example.com>\n+Jane <bugs@example.com>\n ------------\n \n-Then you might want a `.mailmap` file that looks like:\n+A full `.mailmap` file which also handles those cases (an addition of\n+two lines to the above example) would be:\n+\n ------------\n-<cto@company.xx>                       <cto@coompany.xx>\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+Joe R. Developer <joe@example.com>\n+Jane Doe <jane@example.com> <jane@laptop.(none)>\n+Jane Doe <jane@example.com> <jane@desktop.(none)>\n+Joe R. Developer <joe@example.com> Joe <bugs@example.com>\n+Jane Doe <jane@example.com> Jane <bugs@example.com>\n ------------\n \n \ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 5d92880a5a..96ba5367c6 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -419,6 +419,94 @@ test_expect_success 'preserve canonical email case' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'gitmailmap(5) example output: setup' '\n+\ttest_create_repo doc &&\n+\ttest_commit -C doc --author \"Joe Developer <joe@example.com>\" A &&\n+\ttest_commit -C doc --author \"Joe R. Developer <joe@example.com>\" B &&\n+\ttest_commit -C doc --author \"Jane Doe <jane@example.com>\" C &&\n+\ttest_commit -C doc --author \"Jane Doe <jane@laptop.(none)>\" D &&\n+\ttest_commit -C doc --author \"Jane D. <jane@desktop.(none)>\" E\n+'\n+\n+test_expect_success 'gitmailmap(5) example output: example #1' '\n+\ttest_config -C doc mailmap.file ../doc.map &&\n+\tcat >doc.map <<-\\EOF &&\n+\tJoe R. Developer <joe@example.com>\n+\tJane Doe <jane@example.com>\n+\tJane Doe <jane@desktop.(none)>\n+\tEOF\n+\n+\tcat >expect <<-\\EOF &&\n+\tAuthor Joe Developer <joe@example.com> maps to Joe R. Developer <joe@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor Joe R. Developer <joe@example.com> maps to Joe R. Developer <joe@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor Jane Doe <jane@example.com> maps to Jane Doe <jane@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor Jane Doe <jane@laptop.(none)> maps to Jane Doe <jane@laptop.(none)>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor Jane D <jane@desktop.(none)> maps to Jane Doe <jane@desktop.(none)>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\tEOF\n+\tgit -C doc log --reverse --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+test_expect_success 'gitmailmap(5) example output: example #2' '\n+\ttest_config -C doc mailmap.file ../doc.map &&\n+\tcat >doc.map <<-\\EOF &&\n+\tJoe R. Developer <joe@example.com>\n+\tJane Doe <jane@example.com> <jane@laptop.(none)>\n+\tJane Doe <jane@example.com> <jane@desktop.(none)>\n+\tEOF\n+\n+\tcat >expect <<-\\EOF &&\n+\tAuthor Joe Developer <joe@example.com> maps to Joe R. Developer <joe@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor Joe R. Developer <joe@example.com> maps to Joe R. Developer <joe@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor Jane Doe <jane@example.com> maps to Jane Doe <jane@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor Jane Doe <jane@laptop.(none)> maps to Jane Doe <jane@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor Jane D <jane@desktop.(none)> maps to Jane Doe <jane@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\tEOF\n+\tgit -C doc log --reverse --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+test_expect_success 'gitmailmap(5) example output: example #3' '\n+\ttest_config -C doc mailmap.file ../doc.map &&\n+\tcat >>doc.map <<-\\EOF &&\n+\tJoe R. Developer <joe@example.com> Joe <bugs@example.com>\n+\tJane Doe <jane@example.com> Jane <bugs@example.com>\n+\tEOF\n+\n+\ttest_commit -C doc --author \"Joe <bugs@example.com>\" F &&\n+\ttest_commit -C doc --author \"Jane <bugs@example.com>\" G &&\n+\n+\tcat >>expect <<-\\EOF &&\n+\n+\tAuthor Joe <bugs@example.com> maps to Joe R. Developer <joe@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor Jane <bugs@example.com> maps to Jane Doe <jane@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\tEOF\n+\tgit -C doc log --reverse --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+\n test_expect_success 'Shortlog output (complex mapping)' '\n \ttest_config mailmap.file complex.map &&\n \tcat >complex.map <<-EOF &&\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414220","messageId":"20210112201806.13284-19-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 18/22] mailmap tests: add a test for comment syntax","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:18:02Z","receivedAt":"2021-01-12T21:43:49Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add a test for mailmap comment syntax. As noted in [1] there was no\ntest coverage for this. Let's make sure a future change doesn't break\nit.\n\n1. https://lore.kernel.org/git/CAN0heSoKYWXqskCR=GPreSHc6twCSo1345WTmiPdrR57XSShhA@mail.gmail.com/\n\nReported-by: Martin Ågren <martin.agren@gmail.com>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t4203-mailmap.sh | 33 +++++++++++++++++++++++++++++++++\n 1 file changed, 33 insertions(+)\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 96ba5367c6..10e672e006 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -753,4 +753,37 @@ test_expect_success 'commit --author honors mailmap' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'comment syntax: setup' '\n+\ttest_create_repo comm &&\n+\ttest_commit -C comm --author \"A <a@example.com>\" A &&\n+\ttest_commit -C comm --author \"B <b@example.com>\" B &&\n+\ttest_commit -C comm --author \"C <#@example.com>\" C &&\n+\ttest_commit -C comm --author \"D <d@e#ample.com>\" D &&\n+\n+\ttest_config -C comm mailmap.file ../doc.map &&\n+\tcat >>doc.map <<-\\EOF &&\n+\t# Ah <a@example.com>\n+\n+\t; Bee <b@example.com>\n+\tCee <cee@example.com> <#@example.com>\n+\tDee <dee@example.com> <d@e#ample.com>\n+\tEOF\n+\n+\tcat >expect <<-\\EOF &&\n+\tAuthor A <a@example.com> maps to A <a@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor B <b@example.com> maps to ; Bee <b@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor C <#@example.com> maps to Cee <cee@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\n+\tAuthor D <d@e#ample.com> maps to Dee <dee@example.com>\n+\tCommitter C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>\n+\tEOF\n+\tgit -C comm log --reverse --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 test_done\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414221","messageId":"20210112201806.13284-7-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 06/22] mailmap tests: modernize syntax & test idioms","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:50Z","receivedAt":"2021-01-12T21:46:05Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Refactor the mailmap tests to:\n\n * Setup \"actual\" test files in the body of \"test_expect_success\"\n\n * Don't have X of \"test_expect_success X Y\" be an unquoted string.\n\n * Not to carry over test config between tests, and instead use\n   \"test_config\".\n\n * Replace various \"echo\" a line-at-a-time patterns with here-docs.\n\n * Change a case of \"log.mailmap=False\" to use the lower-case\n   \"false\". Both work, but this ends up in git-config's boolean\n   parsing and these atypical values are tested for elsewhere. Let's\n   use the lower-case to not draw the reader's attention to this\n   abnormality.\n\n * Remove commentary asserting that things work a given way in favor\n   of simply testing for it, i.e. in the case of a .mailmap file\n   outside of the repository.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t4203-mailmap.sh | 473 ++++++++++++++++++++++++++-------------------\n 1 file changed, 274 insertions(+), 199 deletions(-)\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 034a78aba1..61d1b62317 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -12,7 +12,7 @@ fuzz_blame () {\n \t\" \"$@\"\n }\n \n-test_expect_success setup '\n+test_expect_success 'setup commits and contacts file' '\n \tcat >contacts <<-EOF &&\n \t$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n \tnick1 <bugs@company.xx>\n@@ -66,128 +66,164 @@ test_expect_success 'check-mailmap bogus contact' '\n \ttest_must_fail git check-mailmap bogus\n '\n \n-cat >expect << EOF\n-$GIT_AUTHOR_NAME (1):\n-      initial\n-\n-nick1 (1):\n-      second\n+test_expect_success 'No mailmap' '\n+\tcat >expect <<-EOF &&\n+\t$GIT_AUTHOR_NAME (1):\n+\t      initial\n \n-EOF\n+\tnick1 (1):\n+\t      second\n \n-test_expect_success 'No mailmap' '\n+\tEOF\n \tgit shortlog HEAD >actual &&\n \ttest_cmp expect actual\n '\n \n-cat >expect <<\\EOF\n-Repo Guy (1):\n-      initial\n+test_expect_success 'setup default .mailmap' '\n+\tcat >default.map <<-EOF\n+\tRepo Guy <$GIT_AUTHOR_EMAIL>\n+\tEOF\n+'\n+\n+test_expect_success 'test default .mailmap' '\n+\ttest_when_finished \"rm .mailmap\" &&\n+\tcp default.map .mailmap &&\n \n-nick1 (1):\n-      second\n+\tcat >expect <<-\\EOF &&\n+\tRepo Guy (1):\n+\t      initial\n \n-EOF\n+\tnick1 (1):\n+\t      second\n \n-test_expect_success 'default .mailmap' '\n-\techo \"Repo Guy <$GIT_AUTHOR_EMAIL>\" > .mailmap &&\n+\tEOF\n \tgit shortlog HEAD >actual &&\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-cat >expect <<\\EOF\n-Internal Guy (1):\n-      second\n+test_expect_success 'mailmap.file set' '\n+\ttest_when_finished \"rm .mailmap\" &&\n+\tcp default.map .mailmap &&\n \n-Repo Guy (1):\n-      initial\n+\ttest_config mailmap.file internal.map &&\n+\tcat >internal.map <<-\\EOF &&\n+\tInternal Guy <bugs@company.xx>\n+\tEOF\n \n-EOF\n-test_expect_success 'mailmap.file set' '\n-\tmkdir -p internal_mailmap &&\n-\techo \"Internal Guy <bugs@company.xx>\" > internal_mailmap/.mailmap &&\n-\tgit config mailmap.file internal_mailmap/.mailmap &&\n+\tcat >expect <<-\\EOF &&\n+\tInternal Guy (1):\n+\t      second\n+\n+\tRepo Guy (1):\n+\t      initial\n+\n+\tEOF\n \tgit shortlog HEAD >actual &&\n-\ttest_cmp expect actual\n+\ttest_cmp expect actual &&\n+\n+\t# The internal_mailmap/.mailmap file is an a subdirectory, but\n+\t# as shown here it can also be outside the repository\n+\ttest_when_finished \"rm -rf sub-repo\" &&\n+\tgit clone . sub-repo &&\n+\t(\n+\t\tcd sub-repo &&\n+\t\tcp ../.mailmap . &&\n+\t\tgit config mailmap.file ../internal.map &&\n+\t\tgit shortlog HEAD >actual &&\n+\t\ttest_cmp ../expect actual\n+\t)\n '\n \n-cat >expect <<\\EOF\n-External Guy (1):\n-      initial\n+test_expect_success 'mailmap.file override' '\n+\ttest_config mailmap.file internal.map &&\n+\tcat >internal.map <<-EOF &&\n+\tInternal Guy <bugs@company.xx>\n+\tExternal Guy <$GIT_AUTHOR_EMAIL>\n+\tEOF\n \n-Internal Guy (1):\n-      second\n+\tcat >expect <<-\\EOF &&\n+\tExternal Guy (1):\n+\t      initial\n \n-EOF\n-test_expect_success 'mailmap.file override' '\n-\techo \"External Guy <$GIT_AUTHOR_EMAIL>\" >> internal_mailmap/.mailmap &&\n-\tgit config mailmap.file internal_mailmap/.mailmap &&\n+\tInternal Guy (1):\n+\t      second\n+\n+\tEOF\n \tgit shortlog HEAD >actual &&\n \ttest_cmp expect actual\n '\n \n-cat >expect <<\\EOF\n-Repo Guy (1):\n-      initial\n+test_expect_success 'mailmap.file non-existent' '\n+\ttest_when_finished \"rm .mailmap\" &&\n+\tcp default.map .mailmap &&\n \n-nick1 (1):\n-      second\n+\tcat >expect <<-\\EOF &&\n+\tRepo Guy (1):\n+\t      initial\n \n-EOF\n+\tnick1 (1):\n+\t      second\n \n-test_expect_success 'mailmap.file non-existent' '\n-\trm internal_mailmap/.mailmap &&\n-\trmdir internal_mailmap &&\n+\tEOF\n \tgit shortlog HEAD >actual &&\n \ttest_cmp expect actual\n '\n \n-cat >expect <<\\EOF\n-Internal Guy (1):\n-      second\n+test_expect_success 'name entry after email entry' '\n+\ttest_when_finished \"rm .mailmap\" &&\n+\tcp default.map .mailmap &&\n \n-Repo Guy (1):\n-      initial\n+\ttest_config mailmap.file internal.map &&\n+\tcat >internal.map <<-\\EOF &&\n+\t<bugs@company.xy> <bugs@company.xx>\n+\tInternal Guy <bugs@company.xx>\n+\tEOF\n \n-EOF\n+\tcat >expect <<-\\EOF &&\n+\tInternal Guy (1):\n+\t      second\n+\n+\tRepo Guy (1):\n+\t      initial\n+\n+\tEOF\n \n-test_expect_success 'name entry after email entry' '\n-\tmkdir -p internal_mailmap &&\n-\techo \"<bugs@company.xy> <bugs@company.xx>\" >internal_mailmap/.mailmap &&\n-\techo \"Internal Guy <bugs@company.xx>\" >>internal_mailmap/.mailmap &&\n \tgit shortlog HEAD >actual &&\n \ttest_cmp expect actual\n '\n \n-cat >expect <<\\EOF\n-Internal Guy (1):\n-      second\n+test_expect_success 'name entry after email entry, case-insensitive' '\n+\ttest_when_finished \"rm .mailmap\" &&\n+\tcp default.map .mailmap &&\n \n-Repo Guy (1):\n-      initial\n+\ttest_config mailmap.file internal.map &&\n+\tcat >internal.map <<-\\EOF &&\n+\t<bugs@company.xy> <bugs@company.xx>\n+\tInternal Guy <BUGS@Company.xx>\n+\tEOF\n \n-EOF\n+\tcat >expect <<-\\EOF &&\n+\tInternal Guy (1):\n+\t      second\n+\n+\tRepo Guy (1):\n+\t      initial\n+\n+\tEOF\n \n-test_expect_success 'name entry after email entry, case-insensitive' '\n-\tmkdir -p internal_mailmap &&\n-\techo \"<bugs@company.xy> <bugs@company.xx>\" >internal_mailmap/.mailmap &&\n-\techo \"Internal Guy <BUGS@Company.xx>\" >>internal_mailmap/.mailmap &&\n \tgit shortlog HEAD >actual &&\n \ttest_cmp expect actual\n '\n \n-cat >expect << EOF\n-$GIT_AUTHOR_NAME (1):\n-      initial\n+test_expect_success 'No mailmap files, but configured' '\n+\tcat >expect <<-EOF &&\n+\t$GIT_AUTHOR_NAME (1):\n+\t      initial\n \n-nick1 (1):\n-      second\n+\tnick1 (1):\n+\t      second\n \n-EOF\n-test_expect_success 'No mailmap files, but configured' '\n-\trm -f .mailmap internal_mailmap/.mailmap &&\n+\tEOF\n \tgit shortlog HEAD >actual &&\n \ttest_cmp expect actual\n '\n@@ -205,11 +241,16 @@ test_expect_success 'setup mailmap blob tests' '\n \tprintf \"Tricky Guy <$GIT_AUTHOR_EMAIL>\" >no-newline &&\n \tgit add just-bugs both no-newline &&\n \tgit commit -m \"my mailmaps\" &&\n-\techo \"Repo Guy <$GIT_AUTHOR_EMAIL>\" >.mailmap &&\n-\techo \"Internal Guy <$GIT_AUTHOR_EMAIL>\" >internal.map\n+\n+\tcat >internal.map <<-EOF\n+\tInternal Guy <$GIT_AUTHOR_EMAIL>\n+\tEOF\n '\n \n test_expect_success 'mailmap.blob set' '\n+\ttest_when_finished \"rm .mailmap\" &&\n+\tcp default.map .mailmap &&\n+\n \tcat >expect <<-\\EOF &&\n \tBlob Guy (1):\n \t      second\n@@ -223,6 +264,9 @@ test_expect_success 'mailmap.blob set' '\n '\n \n test_expect_success 'mailmap.blob overrides .mailmap' '\n+\ttest_when_finished \"rm .mailmap\" &&\n+\tcp default.map .mailmap &&\n+\n \tcat >expect <<-\\EOF &&\n \tBlob Guy (2):\n \t      initial\n@@ -250,6 +294,9 @@ test_expect_success 'mailmap.file overrides mailmap.blob' '\n '\n \n test_expect_success 'mailmap.blob can be missing' '\n+\ttest_when_finished \"rm .mailmap\" &&\n+\tcp default.map .mailmap &&\n+\n \tcat >expect <<-\\EOF &&\n \tRepo Guy (1):\n \t      initial\n@@ -267,11 +314,15 @@ test_expect_success 'mailmap.blob defaults to off in non-bare repo' '\n \t(\n \t\tcd non-bare &&\n \t\ttest_commit one .mailmap \"Fake Name <$GIT_AUTHOR_EMAIL>\" &&\n-\t\techo \"     1\tFake Name\" >expect &&\n+\t\tcat >expect <<-\\EOF &&\n+\t\t     1\tFake Name\n+\t\tEOF\n \t\tgit shortlog -ns HEAD >actual &&\n \t\ttest_cmp expect actual &&\n \t\trm .mailmap &&\n-\t\techo \"     1\t$GIT_AUTHOR_NAME\" >expect &&\n+\t\tcat >expect <<-EOF &&\n+\t\t     1\t$GIT_AUTHOR_NAME\n+\t\tEOF\n \t\tgit shortlog -ns HEAD >actual &&\n \t\ttest_cmp expect actual\n \t)\n@@ -281,7 +332,9 @@ test_expect_success 'mailmap.blob defaults to HEAD:.mailmap in bare repo' '\n \tgit clone --bare non-bare bare &&\n \t(\n \t\tcd bare &&\n-\t\techo \"     1\tFake Name\" >expect &&\n+\t\tcat >expect <<-\\EOF &&\n+\t\t     1\tFake Name\n+\t\tEOF\n \t\tgit shortlog -ns HEAD >actual &&\n \t\ttest_cmp expect actual\n \t)\n@@ -300,50 +353,46 @@ test_expect_success 'mailmap.blob can handle blobs without trailing newline' '\n \ttest_cmp expect actual\n '\n \n-test_expect_success 'cleanup after mailmap.blob tests' '\n-\trm -f .mailmap\n-'\n-\n test_expect_success 'single-character name' '\n-\techo \"     1\tA <$GIT_AUTHOR_EMAIL>\" >expect &&\n-\techo \"     1\tnick1 <bugs@company.xx>\" >>expect &&\n-\techo \"A <$GIT_AUTHOR_EMAIL>\" >.mailmap &&\n \ttest_when_finished \"rm .mailmap\" &&\n+\tcat >.mailmap <<-EOF &&\n+\tA <$GIT_AUTHOR_EMAIL>\n+\tEOF\n+\n+\tcat >expect <<-EOF &&\n+\t     1\tA <$GIT_AUTHOR_EMAIL>\n+\t     1\tnick1 <bugs@company.xx>\n+\tEOF\n \tgit shortlog -es HEAD >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success 'preserve canonical email case' '\n-\techo \"     1\t$GIT_AUTHOR_NAME <AUTHOR@example.com>\" >expect &&\n-\techo \"     1\tnick1 <bugs@company.xx>\" >>expect &&\n-\techo \"<AUTHOR@example.com> <$GIT_AUTHOR_EMAIL>\" >.mailmap &&\n \ttest_when_finished \"rm .mailmap\" &&\n+\tcat >.mailmap <<-EOF &&\n+\t<AUTHOR@example.com> <$GIT_AUTHOR_EMAIL>\n+\tEOF\n+\n+\tcat >expect <<-EOF &&\n+\t     1\t$GIT_AUTHOR_NAME <AUTHOR@example.com>\n+\t     1\tnick1 <bugs@company.xx>\n+\tEOF\n \tgit shortlog -es HEAD >actual &&\n \ttest_cmp expect actual\n '\n \n-# Extended mailmap configurations should give us the following output for shortlog\n-cat >expect << EOF\n-$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> (1):\n-      initial\n-\n-CTO <cto@company.xx> (1):\n-      seventh\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+\ttest_config mailmap.file complex.map &&\n+\tcat >complex.map <<-EOF &&\n+\tCommitted <$GIT_COMMITTER_EMAIL>\n+\t<cto@company.xx> <cto@coompany.xx>\n+\tSome Dude <some@dude.xx>         nick1 <bugs@company.xx>\n+\tOther Author <other@author.xx>   nick2 <bugs@company.xx>\n+\tOther Author <other@author.xx>         <nick2@company.xx>\n+\tSanta Claus <santa.claus@northpole.xx> <me@company.xx>\n+\tSanta Claus <santa.claus@northpole.xx> <me@company.xx>\n+\tEOF\n+\n \techo three >>one &&\n \tgit add one &&\n \ttest_tick &&\n@@ -369,103 +418,119 @@ test_expect_success 'Shortlog output (complex mapping)' '\n \ttest_tick &&\n \tgit commit --author \"CTO <cto@coompany.xx>\" -m seventh &&\n \n-\tmkdir -p internal_mailmap &&\n-\techo \"Committed <$GIT_COMMITTER_EMAIL>\" > internal_mailmap/.mailmap &&\n-\techo \"<cto@company.xx>                       <cto@coompany.xx>\" >> 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+\tcat >expect <<-EOF &&\n+\t$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> (1):\n+\t      initial\n+\n+\tCTO <cto@company.xx> (1):\n+\t      seventh\n+\n+\tOther Author <other@author.xx> (2):\n+\t      third\n+\t      fourth\n+\n+\tSanta Claus <santa.claus@northpole.xx> (2):\n+\t      fifth\n+\t      sixth\n+\n+\tSome Dude <some@dude.xx> (1):\n+\t      second\n+\n+\tEOF\n \n \tgit shortlog -e HEAD >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 CTO <cto@coompany.xx> maps to CTO <cto@company.xx>\n-Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>\n+test_expect_success 'Log output (complex mapping)' '\n+\ttest_config mailmap.file complex.map &&\n \n-Author claus <me@company.xx> maps to Santa Claus <santa.claus@northpole.xx>\n-Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>\n+\tcat >expect <<-EOF &&\n+\tAuthor CTO <cto@coompany.xx> maps to CTO <cto@company.xx>\n+\tCommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>\n \n-Author santa <me@company.xx> maps to Santa Claus <santa.claus@northpole.xx>\n-Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>\n+\tAuthor claus <me@company.xx> maps to Santa Claus <santa.claus@northpole.xx>\n+\tCommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>\n \n-Author nick2 <nick2@company.xx> maps to Other Author <other@author.xx>\n-Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>\n+\tAuthor santa <me@company.xx> maps to Santa Claus <santa.claus@northpole.xx>\n+\tCommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>\n \n-Author nick2 <bugs@company.xx> maps to Other Author <other@author.xx>\n-Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>\n+\tAuthor nick2 <nick2@company.xx> maps to Other Author <other@author.xx>\n+\tCommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>\n \n-Author nick1 <bugs@company.xx> maps to Some Dude <some@dude.xx>\n-Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>\n+\tAuthor nick2 <bugs@company.xx> maps to Other Author <other@author.xx>\n+\tCommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>\n \n-Author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> maps to $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n-Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>\n-EOF\n+\tAuthor nick1 <bugs@company.xx> maps to Some Dude <some@dude.xx>\n+\tCommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>\n+\n+\tAuthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> maps to $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n+\tCommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL>\n+\tEOF\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-cat >expect << EOF\n-Author email cto@coompany.xx has local-part cto\n-Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME\n+test_expect_success 'Log output (local-part email address)' '\n+\tcat >expect <<-EOF &&\n+\tAuthor email cto@coompany.xx has local-part cto\n+\tCommitter email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME\n \n-Author email me@company.xx has local-part me\n-Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME\n+\tAuthor email me@company.xx has local-part me\n+\tCommitter email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME\n \n-Author email me@company.xx has local-part me\n-Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME\n+\tAuthor email me@company.xx has local-part me\n+\tCommitter email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME\n \n-Author email nick2@company.xx has local-part nick2\n-Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME\n+\tAuthor email nick2@company.xx has local-part nick2\n+\tCommitter email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME\n \n-Author email bugs@company.xx has local-part bugs\n-Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME\n+\tAuthor email bugs@company.xx has local-part bugs\n+\tCommitter email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME\n \n-Author email bugs@company.xx has local-part bugs\n-Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME\n+\tAuthor email bugs@company.xx has local-part bugs\n+\tCommitter email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME\n \n-Author email author@example.com has local-part author\n-Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME\n-EOF\n+\tAuthor email author@example.com has local-part author\n+\tCommitter email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME\n+\tEOF\n \n-test_expect_success 'Log output (local-part email address)' '\n \tgit log --pretty=format:\"Author email %ae has local-part %al%nCommitter email %ce has local-part %cl%n\" >actual &&\n \ttest_cmp expect actual\n '\n \n-cat >expect << EOF\n-Author: CTO <cto@company.xx>\n-Author: Santa Claus <santa.claus@northpole.xx>\n-Author: Santa Claus <santa.claus@northpole.xx>\n-Author: Other Author <other@author.xx>\n-Author: Other Author <other@author.xx>\n-Author: Some Dude <some@dude.xx>\n-Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n-EOF\n-\n test_expect_success 'Log output with --use-mailmap' '\n+\ttest_config mailmap.file complex.map &&\n+\n+\tcat >expect <<-EOF &&\n+\tAuthor: CTO <cto@company.xx>\n+\tAuthor: Santa Claus <santa.claus@northpole.xx>\n+\tAuthor: Santa Claus <santa.claus@northpole.xx>\n+\tAuthor: Other Author <other@author.xx>\n+\tAuthor: Other Author <other@author.xx>\n+\tAuthor: Some Dude <some@dude.xx>\n+\tAuthor: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n+\tEOF\n+\n \tgit log --use-mailmap | grep Author >actual &&\n \ttest_cmp expect actual\n '\n \n-cat >expect << EOF\n-Author: CTO <cto@company.xx>\n-Author: Santa Claus <santa.claus@northpole.xx>\n-Author: Santa Claus <santa.claus@northpole.xx>\n-Author: Other Author <other@author.xx>\n-Author: Other Author <other@author.xx>\n-Author: Some Dude <some@dude.xx>\n-Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n-EOF\n-\n test_expect_success 'Log output with log.mailmap' '\n+\ttest_config mailmap.file complex.map &&\n+\n+\tcat >expect <<-EOF &&\n+\tAuthor: CTO <cto@company.xx>\n+\tAuthor: Santa Claus <santa.claus@northpole.xx>\n+\tAuthor: Santa Claus <santa.claus@northpole.xx>\n+\tAuthor: Other Author <other@author.xx>\n+\tAuthor: Other Author <other@author.xx>\n+\tAuthor: Some Dude <some@dude.xx>\n+\tAuthor: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n+\tEOF\n+\n \tgit -c log.mailmap=True log | grep Author >actual &&\n \ttest_cmp expect actual\n '\n@@ -480,7 +545,7 @@ test_expect_success 'log.mailmap=false disables mailmap' '\n \tAuthor: nick1 <bugs@company.xx>\n \tAuthor: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n \tEOF\n-\tgit -c log.mailmap=False log | grep Author >actual &&\n+\tgit -c log.mailmap=false log | grep Author >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -498,56 +563,66 @@ test_expect_success '--no-use-mailmap disables mailmap' '\n \ttest_cmp expect actual\n '\n \n-cat >expect <<\\EOF\n-Author: Santa Claus <santa.claus@northpole.xx>\n-Author: Santa Claus <santa.claus@northpole.xx>\n-EOF\n-\n test_expect_success 'Grep author with --use-mailmap' '\n+\ttest_config mailmap.file complex.map &&\n+\n+\tcat >expect <<-\\EOF &&\n+\tAuthor: Santa Claus <santa.claus@northpole.xx>\n+\tAuthor: Santa Claus <santa.claus@northpole.xx>\n+\tEOF\n \tgit log --use-mailmap --author Santa | grep Author >actual &&\n \ttest_cmp expect actual\n '\n-cat >expect <<\\EOF\n-Author: Santa Claus <santa.claus@northpole.xx>\n-Author: Santa Claus <santa.claus@northpole.xx>\n-EOF\n \n test_expect_success 'Grep author with log.mailmap' '\n+\ttest_config mailmap.file complex.map &&\n+\n+\tcat >expect <<-\\EOF &&\n+\tAuthor: Santa Claus <santa.claus@northpole.xx>\n+\tAuthor: Santa Claus <santa.claus@northpole.xx>\n+\tEOF\n+\n \tgit -c log.mailmap=True log --author Santa | grep Author >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success 'log.mailmap is true by default these days' '\n+\ttest_config mailmap.file complex.map &&\n \tgit log --author Santa | grep Author >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success 'Only grep replaced author with --use-mailmap' '\n+\ttest_config mailmap.file complex.map &&\n \tgit log --use-mailmap --author \"<cto@coompany.xx>\" >actual &&\n \ttest_must_be_empty actual\n '\n \n-# git blame\n-cat >expect <<EOF\n-^OBJI ($GIT_AUTHOR_NAME     DATE 1) one\n-OBJID (Some Dude    DATE 2) two\n-OBJID (Other Author DATE 3) three\n-OBJID (Other Author DATE 4) four\n-OBJID (Santa Claus  DATE 5) five\n-OBJID (Santa Claus  DATE 6) six\n-OBJID (CTO          DATE 7) seven\n-EOF\n test_expect_success 'Blame output (complex mapping)' '\n+\ttest_config mailmap.file complex.map &&\n+\n+\tcat >expect <<-EOF &&\n+\t^OBJI ($GIT_AUTHOR_NAME     DATE 1) one\n+\tOBJID (Some Dude    DATE 2) two\n+\tOBJID (Other Author DATE 3) three\n+\tOBJID (Other Author DATE 4) four\n+\tOBJID (Santa Claus  DATE 5) five\n+\tOBJID (Santa Claus  DATE 6) six\n+\tOBJID (CTO          DATE 7) seven\n+\tEOF\n+\n \tgit blame one >actual &&\n \tfuzz_blame actual >actual.fuzz &&\n \ttest_cmp expect actual.fuzz\n '\n \n-cat >expect <<\\EOF\n-Some Dude <some@dude.xx>\n-EOF\n-\n test_expect_success 'commit --author honors mailmap' '\n+\ttest_config mailmap.file complex.map &&\n+\n+\tcat >expect <<-\\EOF &&\n+\tSome Dude <some@dude.xx>\n+\tEOF\n+\n \ttest_must_fail git commit --author \"nick\" --allow-empty -meight &&\n \tgit commit --author \"Some Dude\" --allow-empty -meight &&\n \tgit show --pretty=format:\"%an <%ae>%n\" >actual &&\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414222","messageId":"20210112201806.13284-6-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 05/22] mailmap tests: use our preferred whitespace syntax","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:49Z","receivedAt":"2021-01-12T21:46:05Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change these tests to use the preferred whitespace around \">\",\n\"<<-EOF\" etc. This is an initial step in larger and more meaningful\nrefactoring of the file, which makes a subsequent commit easier to\nread.\n\nI'm not changing the whitespace of \"echo <str> > file\" patterns to\n\"echo <str> >file\" because all of those will be changed to here-docs\nin a subsequent commit.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t4203-mailmap.sh | 16 ++++++++--------\n 1 file changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 586c3a86b1..034a78aba1 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -13,7 +13,7 @@ fuzz_blame () {\n }\n \n test_expect_success setup '\n-\tcat >contacts <<- EOF &&\n+\tcat >contacts <<-EOF &&\n \t$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n \tnick1 <bugs@company.xx>\n \tEOF\n@@ -33,7 +33,7 @@ test_expect_success 'check-mailmap no arguments' '\n '\n \n test_expect_success 'check-mailmap arguments' '\n-\tcat >expect <<- EOF &&\n+\tcat >expect <<-EOF &&\n \t$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n \tnick1 <bugs@company.xx>\n \tEOF\n@@ -44,7 +44,7 @@ test_expect_success 'check-mailmap arguments' '\n '\n \n test_expect_success 'check-mailmap --stdin' '\n-\tcat >expect <<- EOF &&\n+\tcat >expect <<-EOF &&\n \t$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n \tnick1 <bugs@company.xx>\n \tEOF\n@@ -195,10 +195,10 @@ test_expect_success 'No mailmap files, but configured' '\n test_expect_success 'setup mailmap blob tests' '\n \tgit checkout -b map &&\n \ttest_when_finished \"git checkout master\" &&\n-\tcat >just-bugs <<- EOF &&\n+\tcat >just-bugs <<-\\EOF &&\n \tBlob Guy <bugs@company.xx>\n \tEOF\n-\tcat >both <<- EOF &&\n+\tcat >both <<-EOF &&\n \tBlob Guy <$GIT_AUTHOR_EMAIL>\n \tBlob Guy <bugs@company.xx>\n \tEOF\n@@ -471,7 +471,7 @@ test_expect_success 'Log output with log.mailmap' '\n '\n \n test_expect_success 'log.mailmap=false disables mailmap' '\n-\tcat >expect <<- EOF &&\n+\tcat >expect <<-EOF &&\n \tAuthor: CTO <cto@coompany.xx>\n \tAuthor: claus <me@company.xx>\n \tAuthor: santa <me@company.xx>\n@@ -480,12 +480,12 @@ test_expect_success 'log.mailmap=false disables mailmap' '\n \tAuthor: nick1 <bugs@company.xx>\n \tAuthor: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n \tEOF\n-\tgit -c log.mailmap=False log | grep Author > actual &&\n+\tgit -c log.mailmap=False log | grep Author >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success '--no-use-mailmap disables mailmap' '\n-\tcat >expect <<- EOF &&\n+\tcat >expect <<-EOF &&\n \tAuthor: CTO <cto@coompany.xx>\n \tAuthor: claus <me@company.xx>\n \tAuthor: santa <me@company.xx>\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414223","messageId":"20210112201806.13284-5-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 04/22] mailmap doc: start by mentioning the comment syntax","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:48Z","receivedAt":"2021-01-12T21:46:08Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Mentioning the comment syntax and blank line support first is in line\nwith how \"git help config\" describes its format. See\nb8936cf060 (config.txt grammar, typo, and asciidoc fixes, 2006-06-08)\nfor the paragraph I'm copying & amending from its documentation.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Documentation/gitmailmap.txt | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/gitmailmap.txt b/Documentation/gitmailmap.txt\nindex e75eadde63..4e4677018b 100644\n--- a/Documentation/gitmailmap.txt\n+++ b/Documentation/gitmailmap.txt\n@@ -23,6 +23,9 @@ canonical real names and email addresses.\n SYNTAX\n ------\n \n+The '#' character begins a comment to the end of line, blank lines\n+are ignored.\n+\n In the simple form, each line in the file consists of the canonical\n real name of an author, whitespace, and an email address used in the\n commit (enclosed by '<' and '>') to map to the name. For example:\n@@ -94,8 +97,6 @@ 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 that are either on their own line, or after\n-the email address.\n \n \n SEE ALSO\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414224","messageId":"20210112201806.13284-4-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 03/22] check-mailmap doc: note config options","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:47Z","receivedAt":"2021-01-12T21:46:09Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add a passing mention of the mailmap.file and mailmap.blob\nconfiguration options. Before this addition a reader of the\n\"check-mailmap\" manpage would have no idea that a custom map could be\nspecified, unless they'd happen to e.g. come across it in the \"config\"\nmanpage first.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Documentation/git-check-mailmap.txt | 7 +++++++\n 1 file changed, 7 insertions(+)\n\ndiff --git a/Documentation/git-check-mailmap.txt b/Documentation/git-check-mailmap.txt\nindex 45a5cfafd8..02f4418323 100644\n--- a/Documentation/git-check-mailmap.txt\n+++ b/Documentation/git-check-mailmap.txt\n@@ -36,6 +36,13 @@ name is provided or known to the 'mailmap', ``Name $$<user@host>$$'' is\n printed; otherwise only ``$$<user@host>$$'' is printed.\n \n \n+CONFIGURATION\n+-------------\n+\n+See `mailmap.file` and `mailmap.blob` in linkgit:git-config[1] for how\n+to specify a custom `.mailmap` target file or object.\n+\n+\n MAPPING AUTHORS\n ---------------\n \n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414226","messageId":"20210112201806.13284-2-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 01/22] mailmap doc: create a new \"gitmailmap(5)\" man page","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:45Z","receivedAt":"2021-01-12T21:47:10Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Create a gitmailmap(5) page similar to how .gitmodules and .gitignore\nhave their own pages at gitmodules(5) and gitignore(5). Now instead of\n\"check-mailmap\", \"blame\" and \"shortlog\" documentation including the\ndescription of the format we link to one canonical place.\n\nThis makes things easier for readers, since in our manpage or\nweb-based[1] output it's not clear that the \"MAPPING AUTHORS\" sections\naren't subtly different, as opposed to just included.\n\n1. https://git-scm.com/docs/git-check-mailmap\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Documentation/Makefile                        |  1 +\n Documentation/git-blame.txt                   |  2 +-\n Documentation/git-check-mailmap.txt           |  2 +-\n Documentation/git-shortlog.txt                |  6 +---\n Documentation/{mailmap.txt => gitmailmap.txt} | 33 +++++++++++++++++++\n command-list.txt                              |  1 +\n 6 files changed, 38 insertions(+), 7 deletions(-)\n rename Documentation/{mailmap.txt => gitmailmap.txt} (88%)\n\ndiff --git a/Documentation/Makefile b/Documentation/Makefile\nindex b980407059..81d1bf7a04 100644\n--- a/Documentation/Makefile\n+++ b/Documentation/Makefile\n@@ -21,6 +21,7 @@ MAN1_TXT += gitweb.txt\n MAN5_TXT += gitattributes.txt\n MAN5_TXT += githooks.txt\n MAN5_TXT += gitignore.txt\n+MAN5_TXT += gitmailmap.txt\n MAN5_TXT += gitmodules.txt\n MAN5_TXT += gitrepository-layout.txt\n MAN5_TXT += gitweb.conf.txt\ndiff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt\nindex 34b496d485..3bf5d5d8b4 100644\n--- a/Documentation/git-blame.txt\n+++ b/Documentation/git-blame.txt\n@@ -226,7 +226,7 @@ commit commentary), a blame viewer will not care.\n MAPPING AUTHORS\n ---------------\n \n-include::mailmap.txt[]\n+See linkgit:gitmailmap[5].\n \n \n SEE ALSO\ndiff --git a/Documentation/git-check-mailmap.txt b/Documentation/git-check-mailmap.txt\nindex aa2055dbeb..45a5cfafd8 100644\n--- a/Documentation/git-check-mailmap.txt\n+++ b/Documentation/git-check-mailmap.txt\n@@ -39,7 +39,7 @@ printed; otherwise only ``$$<user@host>$$'' is printed.\n MAPPING AUTHORS\n ---------------\n \n-include::mailmap.txt[]\n+See linkgit:gitmailmap[5].\n \n \n GIT\ndiff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt\nindex fd93cd41e9..c16cc3b608 100644\n--- a/Documentation/git-shortlog.txt\n+++ b/Documentation/git-shortlog.txt\n@@ -111,11 +111,7 @@ include::rev-list-options.txt[]\n MAPPING AUTHORS\n ---------------\n \n-The `.mailmap` feature is used to coalesce together commits by the same\n-person in the shortlog, where their name and/or email address was\n-spelled differently.\n-\n-include::mailmap.txt[]\n+See linkgit:gitmailmap[5].\n \n GIT\n ---\ndiff --git a/Documentation/mailmap.txt b/Documentation/gitmailmap.txt\nsimilarity index 88%\nrename from Documentation/mailmap.txt\nrename to Documentation/gitmailmap.txt\nindex 4a8c276529..8b07f9c5d7 100644\n--- a/Documentation/mailmap.txt\n+++ b/Documentation/gitmailmap.txt\n@@ -1,9 +1,28 @@\n+gitmailmap(5)\n+=============\n+\n+NAME\n+----\n+gitmailmap - Map author/committer names and/or E-Mail addresses\n+\n+SYNOPSIS\n+--------\n+$GIT_WORK_DIR/.mailmap\n+\n+\n+DESCRIPTION\n+-----------\n+\n If the file `.mailmap` exists at the toplevel of the repository, or at\n the location pointed to by the mailmap.file or mailmap.blob\n configuration options, it\n is used to map author and committer names and email addresses to\n canonical real names and email addresses.\n \n+\n+SYNTAX\n+------\n+\n In the simple form, each line in the file consists of the canonical\n real name of an author, whitespace, and an email address used in the\n commit (enclosed by '<' and '>') to map to the name. For example:\n@@ -27,6 +46,10 @@ commit matching the specified commit email address, and:\n which allows mailmap to replace both the name and the email of a\n commit matching both the specified commit name and email address.\n \n+\n+EXAMPLES\n+--------\n+\n Example 1: Your history contains commits by two authors, Jane\n and Joe, whose names appear in the repository under several forms:\n \n@@ -73,3 +96,13 @@ Santa Claus <santa.claus@northpole.xx> <me@company.xx>\n \n Use hash '#' for comments that are either on their own line, or after\n the email address.\n+\n+\n+SEE ALSO\n+--------\n+linkgit:git-check-mailmap[1]\n+\n+\n+GIT\n+---\n+Part of the linkgit:git[1] suite\ndiff --git a/command-list.txt b/command-list.txt\nindex 9379b02e5e..a289f09ed6 100644\n--- a/command-list.txt\n+++ b/command-list.txt\n@@ -204,6 +204,7 @@ gitfaq                                  guide\n gitglossary                             guide\n githooks                                guide\n gitignore                               guide\n+gitmailmap                              guide\n gitmodules                              guide\n gitnamespaces                           guide\n gitremote-helpers                       guide\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414227","messageId":"20210112201806.13284-1-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 00/22] mailmap: doc + test fixes","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:44Z","receivedAt":"2021-01-12T21:47:11Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Just a \"small\" addition to v1, now with 21 extra patches. While this\nis a large series, it should be relatively easy to read and\nnon-contentious. Mainly\n\n * We now have a \"man 5 gitmailmap\", rather than including the format\n   description in N places.\n\n * Lots of extra tests & improvements to modernize existing tests to\n   make them more reliable and easier to read.\n\n * Rewrote the example section in the documentation to be more\n   understandable, and you can now follow it along with tests that\n   mirror it.\n\n * Document that mailmap name/email matching is case-insensitive.\n\n * Document & test for the comment syntax.\n\n * Add an \"--author\" and \"--append\" argument to test_commit, which is\n   used by the mailmap tests, but also a few other tests (just as an\n   example). This is why the series modifies a few non-mailmap tests.\n\nÆvar Arnfjörð Bjarmason (22):\n  mailmap doc: create a new \"gitmailmap(5)\" man page\n  mailmap doc: quote config variables `like.this`\n  check-mailmap doc: note config options\n  mailmap doc: start by mentioning the comment syntax\n  mailmap tests: use our preferred whitespace syntax\n  mailmap tests: modernize syntax & test idioms\n  mailmap tests: improve --stdin tests\n  mailmap tests: remove redundant entry in test\n  mailmap tests: add a test for \"not a blob\" error\n  mailmap tests: get rid of overly complex blame fuzzing\n  mailmap: test for silent exiting on missing file/blob\n  test-lib functions: expand \"test_commit\" comment template\n  test-lib functions: document arguments to test_commit\n  test-lib functions: add --author support to test_commit\n  test-lib functions: add an --append option to test_commit\n  tests: refactor a few tests to use \"test_commit --append\"\n  mailmap doc + tests: add better examples & test them\n  mailmap tests: add a test for comment syntax\n  mailmap tests: add tests for whitespace syntax\n  mailmap tests: add tests for empty \"<>\" syntax\n  mailmap doc + tests: document and test for case-insensitivity\n  shortlog: remove unused(?) \"repo-abbrev\" feature\n\n Documentation/Makefile              |   1 +\n Documentation/git-blame.txt         |   2 +-\n Documentation/git-check-mailmap.txt |   9 +-\n Documentation/git-shortlog.txt      |   6 +-\n Documentation/gitmailmap.txt        | 123 +++++\n Documentation/mailmap.txt           |  75 ---\n builtin/blame.c                     |   2 +-\n builtin/check-mailmap.c             |   2 +-\n builtin/commit.c                    |   2 +-\n builtin/log.c                       |   2 +-\n builtin/shortlog.c                  |  16 +-\n command-list.txt                    |   1 +\n mailmap.c                           |  48 +-\n mailmap.h                           |   2 +-\n pretty.c                            |   2 +-\n shortlog.h                          |   1 -\n t/t1412-reflog-loop.sh              |   7 +-\n t/t2012-checkout-last.sh            |  12 +-\n t/t4203-mailmap.sh                  | 825 +++++++++++++++++++---------\n t/t7509-commit-authorship.sh        |   7 +-\n t/t7810-grep.sh                     |  18 +-\n t/test-lib-functions.sh             |  37 +-\n 22 files changed, 771 insertions(+), 429 deletions(-)\n create mode 100644 Documentation/gitmailmap.txt\n delete mode 100644 Documentation/mailmap.txt\n\n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414228","messageId":"20210112201806.13284-3-avarab@gmail.com","threadId":"43362","inReplyTo":"20210105130359.21139-1-avarab@gmail.com","subject":"[PATCH 02/22] mailmap doc: quote config variables `like.this`","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-12T20:17:46Z","receivedAt":"2021-01-12T21:47:13Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Quote the mailmap.file and mailmap.blob configuration variables as\n`mailmap.file` and `mailmap.blob`, and link to git-config(1). This is\nin line with the preferred way of doing this in the rest of our\ndocumentation.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Documentation/gitmailmap.txt | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/gitmailmap.txt b/Documentation/gitmailmap.txt\nindex 8b07f9c5d7..e75eadde63 100644\n--- a/Documentation/gitmailmap.txt\n+++ b/Documentation/gitmailmap.txt\n@@ -14,8 +14,8 @@ DESCRIPTION\n -----------\n \n If the file `.mailmap` exists at the toplevel of the repository, or at\n-the location pointed to by the mailmap.file or mailmap.blob\n-configuration options, it\n+the location pointed to by the `mailmap.file` or `mailmap.blob`\n+configuration options (see linkgit:git-config[1]), it\n is used to map author and committer names and email addresses to\n canonical real names and email addresses.\n \n-- \n2.29.2.222.g5d2a92d10f8\n\n"},{"id":"414229","messageId":"xmqqwnwh23a3.fsf@gitster.c.googlers.com","threadId":"43362","inReplyTo":"20210112201806.13284-1-avarab@gmail.com","subject":"Re: [PATCH 00/22] mailmap: doc + test fixes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-12T22:34:12Z","receivedAt":"2021-01-12T22:34:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> Just a \"small\" addition to v1, now with 21 extra patches. While this\n\nNeed reminder on what the v1 iteration was about here.  \n\nThanks.\n\n> is a large series, it should be relatively easy to read and\n> non-contentious.\n\nI've read this series through and didn't find anything glaringly\nwrong or contentious.  Very cleanly done.\n\nWill queue.\n"},{"id":"414230","messageId":"xmqqr1mp23a2.fsf@gitster.c.googlers.com","threadId":"43362","inReplyTo":"20210112201806.13284-15-avarab@gmail.com","subject":"Re: [PATCH 14/22] test-lib functions: add --author support to test_commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-12T22:34:13Z","receivedAt":"2021-01-12T22:35:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> Add support for --author to \"test_commit\". This will simplify some\n> current and future tests, one of those is being changed here.\n>\n> Let's also line-wrap the \"git commit\" command invocation to make diffs\n> that add subsequent options easier to add, as they'll only need to add\n> a new option line.\n\nMakes sense.\n\n> -\tgit commit -m \"Initial Commit\" --author Frigate\\ \\<flying@over.world\\> &&\n> -\tgit tag Initial &&\n> +\ttest_commit --author Frigate\\ \\<flying@over.world\\> \\\n> +\t\t\"Initial Commit\" foo Initial Initial &&\n\nWhy not fix the value of the author while at it to be more readable?\nE.g. --author \"Frigate <flying@over.world>\"\n"},{"id":"414231","messageId":"xmqqlfcx239z.fsf@gitster.c.googlers.com","threadId":"43362","inReplyTo":"20210112201806.13284-11-avarab@gmail.com","subject":"Re: [PATCH 10/22] mailmap tests: get rid of overly complex blame fuzzing","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-12T22:34:16Z","receivedAt":"2021-01-12T22:35:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> +\t6 6 1\n> +\tSanta Claus\n> +\t7 7 1\n> +\tCTO\n> +\tEOF\n> +\n> +\tgit blame --porcelain one >actual.blame &&\n> +\tgrep -E \\\n> +\t\t-e \"[0-9]+ [0-9]+ [0-9]+$\" \\\n> +\t\t-e \"^author .*$\" \\\n> +\t\tactual.blame >actual.grep &&\n> +\tcut -d \" \" -f2-4 <actual.grep >actual.fuzz &&\n\nAn approach along the lines of ...\n\n\tNUM=\"[0-9][0-9]*\"\n\tsed -n -e \"s/^author //p\" \\\n\t-e \"s/^$OID_REGEX \\($NUM $NUM $NUM\\)$/\\1/p\"\n\n... would allow you to drop \"cut\" and also not assume that names do\nnot have more than 3 tokens.\n"},{"id":"414232","messageId":"xmqqft35239y.fsf@gitster.c.googlers.com","threadId":"43362","inReplyTo":"20210112201806.13284-10-avarab@gmail.com","subject":"Re: [PATCH 09/22] mailmap tests: add a test for \"not a blob\" error","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-12T22:34:17Z","receivedAt":"2021-01-12T22:35:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> Add a test for one of the error conditions added in\n> 938a60d64f (mailmap: clean up read_mailmap error handling,\n> 2012-12-12).\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>  t/t4203-mailmap.sh | 9 +++++++++\n>  1 file changed, 9 insertions(+)\n\nNice to see a patch that tries to be careful, like this one.\n\n> diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\n> index 03a98d9635..78d56e0566 100755\n> --- a/t/t4203-mailmap.sh\n> +++ b/t/t4203-mailmap.sh\n> @@ -333,6 +333,15 @@ test_expect_success 'mailmap.blob can be missing' '\n>  \ttest_cmp expect actual\n>  '\n>  \n> +test_expect_success 'mailmap.blob might be the wrong type' '\n> +\ttest_when_finished \"rm .mailmap\" &&\n> +\tcp default.map .mailmap &&\n> +\n> +\tgit -c mailmap.blob=HEAD: shortlog HEAD >actual 2>err &&\n> +\ttest_i18ngrep \"mailmap is not a blob\" err &&\n> +\ttest_cmp expect actual\n> +'\n> +\n>  test_expect_success 'mailmap.blob defaults to off in non-bare repo' '\n>  \tgit init non-bare &&\n>  \t(\n"},{"id":"414336","messageId":"X//1iV92dlzGEoJI@generichostname","threadId":"43362","inReplyTo":"20210112201806.13284-15-avarab@gmail.com","subject":"Re: [PATCH 14/22] test-lib functions: add --author support to test_commit","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2021-01-14T07:40:57Z","receivedAt":"2021-01-14T07:41:43Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi Ævar,\n\nOn Tue, Jan 12, 2021 at 09:17:58PM +0100, Ævar Arnfjörð Bjarmason wrote:\n> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\n> index 194b601bc0..529f6264fe 100644\n> --- a/t/test-lib-functions.sh\n> +++ b/t/test-lib-functions.sh\n> @@ -185,6 +185,8 @@ debug () {\n>  #\tDo not call test_tick before making a commit\n>  #   --signoff\n>  #\tInvoke \"git commit\" with --signoff\n> +#   --author=<author>\n\nThe usage shows that you have to specify the author argument with an\nequal sign...\n\n> +#\tInvoke \"git commit\" with --author=<author>\n>  #\n>  # This will commit a file with the given contents and the given commit\n>  # message, and tag the resulting commit with the given tag name.\n> @@ -193,6 +195,7 @@ debug () {\n>  \n>  test_commit () {\n>  \tnotick= &&\n> +\tauthor= &&\n>  \tsignoff= &&\n>  \tindir= &&\n>  \twhile test $# != 0\n> @@ -201,6 +204,10 @@ test_commit () {\n>  \t\t--notick)\n>  \t\t\tnotick=yes\n>  \t\t\t;;\n> +\t\t--author)\n> +\t\t\tauthor=\"$2\"\n\nbut over here, it's only parsed if they're presented as two separate\ntokens. We should correct the usage text accordingly.\n\nThanks,\nDenton\n\n> +\t\t\tshift\n> +\t\t\t;;\n>  \t\t--signoff)\n>  \t\t\tsignoff=\"$1\"\n>  \t\t\t;;\n"},{"id":"414337","messageId":"X//4ErmvlK+lIju9@generichostname","threadId":"43362","inReplyTo":"20210112201806.13284-7-avarab@gmail.com","subject":"Re: [PATCH 06/22] mailmap tests: modernize syntax & test idioms","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2021-01-14T07:51:46Z","receivedAt":"2021-01-14T07:52:42Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi Ævar,\n\nOn Tue, Jan 12, 2021 at 09:17:50PM +0100, Ævar Arnfjörð Bjarmason wrote:\n> @@ -480,7 +545,7 @@ test_expect_success 'log.mailmap=false disables mailmap' '\n>  \tAuthor: nick1 <bugs@company.xx>\n>  \tAuthor: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n>  \tEOF\n> -\tgit -c log.mailmap=False log | grep Author >actual &&\n> +\tgit -c log.mailmap=false log | grep Author >actual &&\n\nWhile you're doing test cleanup, here's another suggestion: we should\nbreak all these pipes where git is in the upstream of a pipe. The return\ncode of a pipe comes from the last thing run which means if git outputs\ncorrectly but then somehow fails after, we won't detect the failure.\n\nIn general, I've stopped my crusade against these because it seems like\nit's more noise than it's worth in most cases but in this case, since\nwe're exercising mailmap codepaths that aren't tested in other test\ncases, this pipe could plausibly hide a failure that isn't seen\nanywhere else.\n\nThanks,\nDenton\n\n>  \ttest_cmp expect actual\n>  '\n"},{"id":"414344","messageId":"87zh1b51xk.fsf@evledraar.gmail.com","threadId":"43362","inReplyTo":"xmqqwnwh23a3.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 00/22] mailmap: doc + test fixes","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-14T08:59:35Z","receivedAt":"2021-01-14T09:00:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Tue, Jan 12 2021, Junio C Hamano wrote:\n\n> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>\n>> Just a \"small\" addition to v1, now with 21 extra patches. While this\n>\n> Need reminder on what the v1 iteration was about here.  \n\nJust the 22/22 patch for removing \"repo-abbrev\".\n\n>> is a large series, it should be relatively easy to read and\n>> non-contentious.\n>\n> I've read this series through and didn't find anything glaringly\n> wrong or contentious.  Very cleanly done.\n\nThanks, I saw you merged it down to \"next\" already. Should make any\nconflicts with other mailmap serieses short-lived.\n"},{"id":"414368","messageId":"a71860ee-6810-8766-b9c7-4c03ea7e6e01@gmail.com","threadId":"43362","inReplyTo":"20210112201806.13284-2-avarab@gmail.com","subject":"Re: [PATCH 01/22] mailmap doc: create a new \"gitmailmap(5)\" man page","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2021-01-14T17:41:20Z","receivedAt":"2021-01-14T17:42:04Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hi Ævar,\n\nLe 2021-01-12 à 15:17, Ævar Arnfjörð Bjarmason a écrit :\n> Create a gitmailmap(5) page similar to how .gitmodules and .gitignore\n> have their own pages at gitmodules(5) and gitignore(5). Now instead of\n> \"check-mailmap\", \"blame\" and \"shortlog\" documentation including the\n> description of the format we link to one canonical place.\n> \n> This makes things easier for readers, since in our manpage or\n> web-based[1] output it's not clear that the \"MAPPING AUTHORS\" sections\n> aren't subtly different, as opposed to just included.\n> \n> 1. https://git-scm.com/docs/git-check-mailmap\n\nI think that's a good idea.\n\n> \n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>   Documentation/Makefile                        |  1 +\n>   Documentation/git-blame.txt                   |  2 +-\n>   Documentation/git-check-mailmap.txt           |  2 +-\n>   Documentation/git-shortlog.txt                |  6 +---\n>   Documentation/{mailmap.txt => gitmailmap.txt} | 33 +++++++++++++++++++\n>   command-list.txt                              |  1 +\n\nNice to see that the comment I added in Documentation/Makefile\nabout command-list.txt served its purpose :)\n\n>   6 files changed, 38 insertions(+), 7 deletions(-)\n>   rename Documentation/{mailmap.txt => gitmailmap.txt} (88%)\n> \n\n-- 8< --\n\n> diff --git a/Documentation/mailmap.txt b/Documentation/gitmailmap.txt\n> similarity index 88%\n> rename from Documentation/mailmap.txt\n> rename to Documentation/gitmailmap.txt\n> index 4a8c276529..8b07f9c5d7 100644\n> --- a/Documentation/mailmap.txt\n> +++ b/Documentation/gitmailmap.txt\n> @@ -1,9 +1,28 @@\n> +gitmailmap(5)\n> +=============\n> +\n> +NAME\n> +----\n> +gitmailmap - Map author/committer names and/or E-Mail addresses\n> +\n> +SYNOPSIS\n> +--------\n> +$GIT_WORK_DIR/.mailmap\n\nThis should be GIT_WORK_TREE, gitmodules(5) is wrong as GIT_WORK_DIR\ndoes not exists (my series at [1] fixes this).\n\nAlso, if you feel like this new guide should be featured in the \"Guides\" column\nat git-scm.com/docs, I encourage you to submit a PR to the website. Though\nI think for this specific guide, simply having it listed in git(1), linked from the\n\"All guides...\" link at the bottom of that column, is sufficient.\n\nCheers,\n\nPhilippe.\n\n[1] https://lore.kernel.org/git/pull.942.v2.git.git.1609695736001.gitgitgadget@gmail.com/\n"},{"id":"414380","messageId":"xmqqk0sfxpd4.fsf@gitster.c.googlers.com","threadId":"43362","inReplyTo":"a71860ee-6810-8766-b9c7-4c03ea7e6e01@gmail.com","subject":"Re: [PATCH 01/22] mailmap doc: create a new \"gitmailmap(5)\" man page","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-14T19:58:15Z","receivedAt":"2021-01-14T19:59:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Philippe Blain <levraiphilippeblain@gmail.com> writes:\n\n>> +SYNOPSIS\n>> +--------\n>> +$GIT_WORK_DIR/.mailmap\n>\n> This should be GIT_WORK_TREE, gitmodules(5) is wrong as GIT_WORK_DIR\n> does not exists (my series at [1] fixes this).\n\nWell spotted.\n\nCan you make the suggestion into a follow-up patch to the\nseries to be applied on top?\n\nThanks.\n"},{"id":"414381","messageId":"xmqqft33xp9b.fsf@gitster.c.googlers.com","threadId":"43362","inReplyTo":"X//4ErmvlK+lIju9@generichostname","subject":"Re: [PATCH 06/22] mailmap tests: modernize syntax & test idioms","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-14T20:00:32Z","receivedAt":"2021-01-14T20:01:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> On Tue, Jan 12, 2021 at 09:17:50PM +0100, Ævar Arnfjörð Bjarmason wrote:\n>> @@ -480,7 +545,7 @@ test_expect_success 'log.mailmap=false disables mailmap' '\n>>  \tAuthor: nick1 <bugs@company.xx>\n>>  \tAuthor: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n>>  \tEOF\n>> -\tgit -c log.mailmap=False log | grep Author >actual &&\n>> +\tgit -c log.mailmap=false log | grep Author >actual &&\n>\n> While you're doing test cleanup, here's another suggestion: we should\n> break all these pipes where git is in the upstream of a pipe. The return\n> code of a pipe comes from the last thing run which means if git outputs\n> correctly but then somehow fails after, we won't detect the failure.\n>\n> In general, I've stopped my crusade against these because it seems like\n> it's more noise than it's worth in most cases but in this case, since\n> we're exercising mailmap codepaths that aren't tested in other test\n> cases, this pipe could plausibly hide a failure that isn't seen\n> anywhere else.\n\nYeah, I agree with your assessment that it does make sense to make\nsure this \"log\" does not crash silently.\n\nI find it unlikely for \"log\" to crash while giving an expected\nAuthor line to its output stream, though.\n\nCan you make your suggestion into a follow-up patch to be applied on\ntop of the series?\n\nThanks.\n"},{"id":"414387","messageId":"xmqqbldrxo9o.fsf@gitster.c.googlers.com","threadId":"43362","inReplyTo":"xmqqlfcx239z.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 10/22] mailmap tests: get rid of overly complex blame fuzzing","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-14T20:21:55Z","receivedAt":"2021-01-14T20:22:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>\n>> +\t6 6 1\n>> +\tSanta Claus\n>> +\t7 7 1\n>> +\tCTO\n>> +\tEOF\n>> +\n>> +\tgit blame --porcelain one >actual.blame &&\n>> +\tgrep -E \\\n>> +\t\t-e \"[0-9]+ [0-9]+ [0-9]+$\" \\\n>> +\t\t-e \"^author .*$\" \\\n>> +\t\tactual.blame >actual.grep &&\n>> +\tcut -d \" \" -f2-4 <actual.grep >actual.fuzz &&\n>\n> An approach along the lines of ...\n>\n> \tNUM=\"[0-9][0-9]*\"\n> \tsed -n -e \"s/^author //p\" \\\n> \t-e \"s/^$OID_REGEX \\($NUM $NUM $NUM\\)$/\\1/p\"\n>\n> ... would allow you to drop \"cut\" and also not assume that names do\n> not have more than 3 tokens.\n\nTrying to lead by example..., here is the suggestion in a follow-up\npatch form that can be applied on top of the series.\n\n----- >8 ----- ----- >8 ----- ----- >8 ----- ----- >8 ----- ----- >8 -----\nSubject: [PATCH] t4203: make blame output massaging more robust\n\nIn the \"git blame --porcelain\" output, lines that ends with three\nintegers may not be the line that shows a commit object with line\nnumbers and block length (the contents from the blamed file or the\nsummary field can have a line that happens to match).  Also, the\nnames of the author may have more than three SP separated tokens\n(\"git blame -L242,+1 cf6de18aabf7 Documentation/SubmittingPatches\"\ngives an example).  The existing \"grep -E | cut\" pipeline is a bit\ntoo loose on these two points.\n\nWhile they can be assumed on the test data, it is not so hard to\nuse the right pattern from the documented format, so let's do so.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t4203-mailmap.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git c/t/t4203-mailmap.sh i/t/t4203-mailmap.sh\nindex 89cb300f28..d4a6e73736 100755\n--- c/t/t4203-mailmap.sh\n+++ i/t/t4203-mailmap.sh\n@@ -739,11 +739,11 @@ test_expect_success 'Blame --porcelain output (complex mapping)' '\n \tEOF\n \n \tgit blame --porcelain one >actual.blame &&\n-\tgrep -E \\\n-\t\t-e \"[0-9]+ [0-9]+ [0-9]+$\" \\\n-\t\t-e \"^author .*$\" \\\n-\t\tactual.blame >actual.grep &&\n-\tcut -d \" \" -f2-4 <actual.grep >actual.fuzz &&\n+\n+\tNUM=\"[0-9][0-9]*\" &&\n+\tsed -n <actual.blame >actual.fuzz \\\n+\t\t-e \"s/^author //p\" \\\n+\t\t-e \"s/^$OID_REGEX \\\\($NUM $NUM $NUM\\\\)$/\\\\1/p\"  &&\n \ttest_cmp expect actual.fuzz\n '\n \n\n"},{"id":"414394","messageId":"cover.1610665323.git.liu.denton@gmail.com","threadId":"43362","inReplyTo":"20210112201806.13284-1-avarab@gmail.com","subject":"[PATCH 0/2] mailmap: test cleanup","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2021-01-14T23:02:39Z","receivedAt":"2021-01-14T23:03:41Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"A couple of small test cleanups that can be applied on top of\n'ab/mailmap'.\n\nDenton Liu (2):\n  test-lib-functions.sh: fix usage for test_commit()\n  t4203: stop losing return codes of git commands\n\n t/t4203-mailmap.sh      | 21 ++++++++++++++-------\n t/test-lib-functions.sh |  4 ++--\n 2 files changed, 16 insertions(+), 9 deletions(-)\n\n-- \n2.30.0.284.gd98b1dd5ea\n\n"},{"id":"414395","messageId":"e9add5f066cb0209ff9f6a0ef71584b54afd04d7.1610665323.git.liu.denton@gmail.com","threadId":"43362","inReplyTo":"cover.1610665323.git.liu.denton@gmail.com","subject":"[PATCH 1/2] test-lib-functions.sh: fix usage for test_commit()","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2021-01-14T23:02:40Z","receivedAt":"2021-01-14T23:03:57Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The usage comment for test_commit() shows that the --author option\nshould be given as `--author=<author>`. However, this is incorrect as it\nonly works when given as `--author <author>`. Correct this erroneous\ntext.\n\nAlso, for the sake of correctness, fix the description as well since we\ninvoke `git commit` with `--author <author>`, not `--author=<author>`.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/test-lib-functions.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex b0a5d74dc7..cea73cb8f0 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -188,8 +188,8 @@ debug () {\n #\t\"<file>\"\n #   --signoff\n #\tInvoke \"git commit\" with --signoff\n-#   --author=<author>\n-#\tInvoke \"git commit\" with --author=<author>\n+#   --author <author>\n+#\tInvoke \"git commit\" with --author <author>\n #\n # This will commit a file with the given contents and the given commit\n # message, and tag the resulting commit with the given tag name.\n-- \n2.30.0.284.gd98b1dd5ea\n\n"},{"id":"414396","messageId":"b31347c9f5d70fd8479ba37d82c75d5131bc1ca0.1610665323.git.liu.denton@gmail.com","threadId":"43362","inReplyTo":"cover.1610665323.git.liu.denton@gmail.com","subject":"[PATCH 2/2] t4203: stop losing return codes of git commands","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2021-01-14T23:02:41Z","receivedAt":"2021-01-14T23:03:57Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In a pipe, only the return code of the last command is used. Thus, all\nother commands will have their return codes masked. Rewrite pipes so\nthat there are no git commands upstream so that their failure is\nreported.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t4203-mailmap.sh | 21 ++++++++++++++-------\n 1 file changed, 14 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 89cb300f28..c9cb1aa127 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -634,7 +634,8 @@ test_expect_success 'Log output with --use-mailmap' '\n \tAuthor: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n \tEOF\n \n-\tgit log --use-mailmap | grep Author >actual &&\n+\tgit log --use-mailmap >log &&\n+\tgrep Author log >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -651,7 +652,8 @@ test_expect_success 'Log output with log.mailmap' '\n \tAuthor: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n \tEOF\n \n-\tgit -c log.mailmap=True log | grep Author >actual &&\n+\tgit -c log.mailmap=True log >log &&\n+\tgrep Author log >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -665,7 +667,8 @@ test_expect_success 'log.mailmap=false disables mailmap' '\n \tAuthor: nick1 <bugs@company.xx>\n \tAuthor: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n \tEOF\n-\tgit -c log.mailmap=false log | grep Author >actual &&\n+\tgit -c log.mailmap=false log >log &&\n+\tgrep Author log >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -679,7 +682,8 @@ test_expect_success '--no-use-mailmap disables mailmap' '\n \tAuthor: nick1 <bugs@company.xx>\n \tAuthor: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>\n \tEOF\n-\tgit log --no-use-mailmap | grep Author > actual &&\n+\tgit log --no-use-mailmap >log &&\n+\tgrep Author log >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -690,7 +694,8 @@ test_expect_success 'Grep author with --use-mailmap' '\n \tAuthor: Santa Claus <santa.claus@northpole.xx>\n \tAuthor: Santa Claus <santa.claus@northpole.xx>\n \tEOF\n-\tgit log --use-mailmap --author Santa | grep Author >actual &&\n+\tgit log --use-mailmap --author Santa >log &&\n+\tgrep Author log >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -702,13 +707,15 @@ test_expect_success 'Grep author with log.mailmap' '\n \tAuthor: Santa Claus <santa.claus@northpole.xx>\n \tEOF\n \n-\tgit -c log.mailmap=True log --author Santa | grep Author >actual &&\n+\tgit -c log.mailmap=True log --author Santa >log &&\n+\tgrep Author log >actual &&\n \ttest_cmp expect actual\n '\n \n test_expect_success 'log.mailmap is true by default these days' '\n \ttest_config mailmap.file complex.map &&\n-\tgit log --author Santa | grep Author >actual &&\n+\tgit log --author Santa >log &&\n+\tgrep Author log >actual &&\n \ttest_cmp expect actual\n '\n \n-- \n2.30.0.284.gd98b1dd5ea\n\n"},{"id":"414408","messageId":"87wnwf3vd5.fsf@evledraar.gmail.com","threadId":"43362","inReplyTo":"e9add5f066cb0209ff9f6a0ef71584b54afd04d7.1610665323.git.liu.denton@gmail.com","subject":"Re: [PATCH 1/2] test-lib-functions.sh: fix usage for test_commit()","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-15T00:19:02Z","receivedAt":"2021-01-15T00:19:47Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Fri, Jan 15 2021, Denton Liu wrote:\n\n> The usage comment for test_commit() shows that the --author option\n> should be given as `--author=<author>`. However, this is incorrect as it\n> only works when given as `--author <author>`. Correct this erroneous\n> text.\n>\n> Also, for the sake of correctness, fix the description as well since we\n> invoke `git commit` with `--author <author>`, not `--author=<author>`.\n\nLGTM. Thanks for fixing this.\n\nFWIW I was planning to make it just support --author=*, the\ntest_commit_bulk() function just below that does that, I think I copied\nits doc template, but then used test_commit's existing pattern for\noptions parsing.\n\nBut this works just as well, and is easier :)\n\n>\n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n>  t/test-lib-functions.sh | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\n> index b0a5d74dc7..cea73cb8f0 100644\n> --- a/t/test-lib-functions.sh\n> +++ b/t/test-lib-functions.sh\n> @@ -188,8 +188,8 @@ debug () {\n>  #\t\"<file>\"\n>  #   --signoff\n>  #\tInvoke \"git commit\" with --signoff\n> -#   --author=<author>\n> -#\tInvoke \"git commit\" with --author=<author>\n> +#   --author <author>\n> +#\tInvoke \"git commit\" with --author <author>\n>  #\n>  # This will commit a file with the given contents and the given commit\n>  # message, and tag the resulting commit with the given tag name.\n\n"},{"id":"414409","messageId":"87turj3van.fsf@evledraar.gmail.com","threadId":"43362","inReplyTo":"b31347c9f5d70fd8479ba37d82c75d5131bc1ca0.1610665323.git.liu.denton@gmail.com","subject":"Re: [PATCH 2/2] t4203: stop losing return codes of git commands","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-01-15T00:20:32Z","receivedAt":"2021-01-15T00:21:39Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Fri, Jan 15 2021, Denton Liu wrote:\n\n> In a pipe, only the return code of the last command is used. Thus, all\n> other commands will have their return codes masked. Rewrite pipes so\n> that there are no git commands upstream so that their failure is\n> reported.\n\nI tried to fix this in a much harder way today :)\nhttps://lore.kernel.org/git/20210114233515.31298-1-avarab@gmail.com/\n\nBut this is both easier and obviously correct, thanks!\n"},{"id":"414419","messageId":"20210115023416.45011-1-levraiphilippeblain@gmail.com","threadId":"43362","inReplyTo":"20210112201806.13284-2-avarab@gmail.com","subject":"[PATCH] fixup! mailmap doc: create a new \"gitmailmap(5)\" man page","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2021-01-15T02:34:16Z","receivedAt":"2021-01-15T02:35:01Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n Documentation/gitmailmap.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/gitmailmap.txt b/Documentation/gitmailmap.txt\nindex 7f1089786d..052209b33b 100644\n--- a/Documentation/gitmailmap.txt\n+++ b/Documentation/gitmailmap.txt\n@@ -7,7 +7,7 @@ gitmailmap - Map author/committer names and/or E-Mail addresses\n \n SYNOPSIS\n --------\n-$GIT_WORK_DIR/.mailmap\n+$GIT_WORK_TREE/.mailmap\n \n \n DESCRIPTION\n\nbase-commit: 4e168333a8716d902aed10c74ae5e408e683f902\n-- \n2.29.2\n\n"},{"id":"414421","messageId":"6612514d-051a-1e58-7ea1-c00428882f2d@gmail.com","threadId":"43362","inReplyTo":"xmqqk0sfxpd4.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 01/22] mailmap doc: create a new \"gitmailmap(5)\" man page","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2021-01-15T02:38:35Z","receivedAt":"2021-01-15T02:39:34Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hi Junio\n\nLe 2021-01-14 à 14:58, Junio C Hamano a écrit :\n> Philippe Blain <levraiphilippeblain@gmail.com> writes:\n> \n>>> +SYNOPSIS\n>>> +--------\n>>> +$GIT_WORK_DIR/.mailmap\n>>\n>> This should be GIT_WORK_TREE, gitmodules(5) is wrong as GIT_WORK_DIR\n>> does not exists (my series at [1] fixes this).\n> \n> Well spotted.\n> \n> Can you make the suggestion into a follow-up patch to the\n> series to be applied on top?\n> \n\nI just sent [1] as a fixup! commit (is that what you meant?)\nI was not sure...) I feel it is cleaner for that commit to use\nthe correct variable name from the start, hence the fixup.\n\nPhilippe.\n\n[1] https://lore.kernel.org/git/87zh1b51xk.fsf@evledraar.gmail.com/T/#m9e8e8f5458db71153c2363acf4bff959df7d0f4c\n"},{"id":"414425","messageId":"xmqqft32vqe4.fsf@gitster.c.googlers.com","threadId":"43362","inReplyTo":"6612514d-051a-1e58-7ea1-c00428882f2d@gmail.com","subject":"Re: [PATCH 01/22] mailmap doc: create a new \"gitmailmap(5)\" man page","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-15T03:18:59Z","receivedAt":"2021-01-15T03:20:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Philippe Blain <levraiphilippeblain@gmail.com> writes:\n\n> I was not sure...) I feel it is cleaner for that commit to use\n> the correct variable name from the start, hence the fixup.\n\nThe topic is already in 'next', and that is why I asked follow-up\npatches on top from people.  Otherwise I wouldn't have asked and\ninstead just squashed these fixes in while the topic was in 'seen'.\n\nThanks.\n\n"},{"id":"414426","messageId":"20210115032826.51369-1-levraiphilippeblain@gmail.com","threadId":"43362","inReplyTo":"20210115023416.45011-1-levraiphilippeblain@gmail.com","subject":"[PATCH v2] mailmap doc: use correct environment variable 'GIT_WORK_TREE'","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2021-01-15T03:28:25Z","receivedAt":"2021-01-15T03:29:10Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"gitmailmap(5) uses 'GIT_WORK_DIR' to refer to the root of the\nrepository, but this environment variable does not exist.\n\nUse the correct spelling for that variable, 'GIT_WORK_TREE'.\n\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n Documentation/gitmailmap.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/gitmailmap.txt b/Documentation/gitmailmap.txt\nindex 7f1089786d..052209b33b 100644\n--- a/Documentation/gitmailmap.txt\n+++ b/Documentation/gitmailmap.txt\n@@ -7,7 +7,7 @@ gitmailmap - Map author/committer names and/or E-Mail addresses\n \n SYNOPSIS\n --------\n-$GIT_WORK_DIR/.mailmap\n+$GIT_WORK_TREE/.mailmap\n \n \n DESCRIPTION\n\nbase-commit: 4e168333a8716d902aed10c74ae5e408e683f902\n-- \n2.29.2\n\n"},{"id":"414427","messageId":"4c9123c0-ee35-11aa-04dc-8ffe79781507@gmail.com","threadId":"43362","inReplyTo":"xmqqft32vqe4.fsf@gitster.c.googlers.com","subject":"Re: [PATCH 01/22] mailmap doc: create a new \"gitmailmap(5)\" man page","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2021-01-15T03:36:46Z","receivedAt":"2021-01-15T03:37:31Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"\nLe 2021-01-14 à 22:18, Junio C Hamano a écrit :\n> Philippe Blain <levraiphilippeblain@gmail.com> writes:\n> \n>> I was not sure...) I feel it is cleaner for that commit to use\n>> the correct variable name from the start, hence the fixup.\n> \n> The topic is already in 'next', and that is why I asked follow-up\n> patches on top from people.  Otherwise I wouldn't have asked and\n> instead just squashed these fixes in while the topic was in 'seen'.\n\nOK, thanks for clarifying. I did not check the status of the series,\nprobably because I saw it was from just 2 days ago so I did not think it\nwould already be in next. I just sent a v2 with a proper commit message [2].\n\nI'm still not sure I have should have sent it as a reply to the commit it's\nfixing (as I did), or to the last commit of the series, or to the cover letter,\nor as a new thread to the list... what's the etiquette around this ?\n(I'm still new to the email workflow, especially around multi-author series...)\n\nPhilippe.\n\n[2] https://lore.kernel.org/git/20210115032826.51369-1-levraiphilippeblain@gmail.com/\n"},{"id":"414429","messageId":"xmqq5z3yvj8k.fsf@gitster.c.googlers.com","threadId":"43362","inReplyTo":"4c9123c0-ee35-11aa-04dc-8ffe79781507@gmail.com","subject":"Re: [PATCH 01/22] mailmap doc: create a new \"gitmailmap(5)\" man page","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-01-15T05:53:31Z","receivedAt":"2021-01-15T05:54:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Philippe Blain <levraiphilippeblain@gmail.com> writes:\n\n> I'm still not sure I have should have sent it as a reply to the commit it's\n> fixing (as I did), or to the last commit of the series, or to the cover letter,\n> or as a new thread to the list... what's the etiquette around this ?\n\nI can deal with any of the above, but with the goal of keeping the\nlist archive most useful for later readers, I would imagine that it\nwould be best if such a follow-up fix were made against the specific\nstep (if there is such a single step) that introduced an issue (in\nother words, where you would have squashed your fix into, if it were\nunder your control to redo the series).  If there is no such single\nstep and the fix applies to the whole series in general, a response\nto its cover letter would also do, I would think.\n\nThanks.\n"}]}