{"thread":{"id":"51466","subject":"[PATCH v2 0/3] use mailmap by default in git log","startedAt":"2019-07-11T17:26:39Z","lastAt":"2019-07-11T18:27:11Z","messageCount":9,"participants":["Ariadne Conill","Beat Bolli"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"378833","messageId":"20190711172626.16480-1-ariadne@dereferenced.org","threadId":"51466","inReplyTo":null,"subject":"[PATCH v2 0/3] use mailmap by default in git log","fromName":"Ariadne Conill","fromEmail":"ariadne@dereferenced.org","sentAt":"2019-07-11T17:26:23Z","receivedAt":"2019-07-11T17:26:39Z","isPatch":true,"sender":{"key":"ariadne@dereferenced.org","avatar":"https://avatars.githubusercontent.com/u/1522444?v=4"},"body":"It is not uncommon for people to change their name or e-mail address.\nTo facilitate this, Git provides support for the `.mailmap` file,\nwhich contains a list of identities and previously used e-mail\naddresses that are associated with that identity.\n\nUnfortunately, while Git's support for the `.mailmap` file is generally\nexcellent, I recently discovered that `git log` does not treat the\nmail map file the same as the other tools, instead requiring an\nexplicit flag to use the mailmap file.\n\nI believe this is an unfortunate flaw, as the mailmap file should\nideally contain the most current known contact information for a\ncontributor, allowing anyone to contact the contributor about their\npatches in the future.\n\nNew in version 2:\n- The `--no-use-mailmap` option, which complements `--use-mailmap`.\n- Tests for `--no-use-mailmap`.\n\nAriadne Conill (3):\n  log: use mailmap by default\n  log: add --no-use-mailmap option to complement --use-mailmap option\n  tests: add test for git log --no-use-mailmap\n\n Documentation/git-log.txt | 5 +++++\n builtin/log.c             | 3 ++-\n t/t4203-mailmap.sh        | 8 ++++++++\n 3 files changed, 15 insertions(+), 1 deletion(-)\n\n-- \n2.17.1\n\n"},{"id":"378834","messageId":"20190711172626.16480-2-ariadne@dereferenced.org","threadId":"51466","inReplyTo":"20190711172626.16480-1-ariadne@dereferenced.org","subject":"[PATCH v2 1/3] log: use mailmap by default","fromName":"Ariadne Conill","fromEmail":"ariadne@dereferenced.org","sentAt":"2019-07-11T17:26:24Z","receivedAt":"2019-07-11T17:26:44Z","isPatch":true,"sender":{"key":"ariadne@dereferenced.org","avatar":"https://avatars.githubusercontent.com/u/1522444?v=4"},"body":"The `git log` command shows the author and committer name recorded in\nthe git repository itself, while other commands respect `.mailmap`\nby default.  I believe this is a bad design: it causes log entries to\nreflect inaccurate information: anyone who changes their name or\ne-mail address will not have that change (recorded in mailmap file)\nreflected when using `git log` by default.\n\nAnyone who explicitly wants the current behaviour can clearly request\nit by setting the `log.mailmap` setting to `false` in their\n`.gitconfig` file.\n\nSigned-off-by: Ariadne Conill <ariadne@dereferenced.org>\n---\n builtin/log.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 7c8767d3bc..3d2ce8fa3d 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -47,7 +47,7 @@ static int default_follow;\n static int default_show_signature;\n static int decoration_style;\n static int decoration_given;\n-static int use_mailmap_config;\n+static int use_mailmap_config = 1;\n static const char *fmt_patch_subject_prefix = \"PATCH\";\n static const char *fmt_pretty;\n \n-- \n2.17.1\n\n"},{"id":"378835","messageId":"20190711172626.16480-3-ariadne@dereferenced.org","threadId":"51466","inReplyTo":"20190711172626.16480-1-ariadne@dereferenced.org","subject":"[PATCH v2 2/3] log: add --no-use-mailmap option to complement --use-mailmap option","fromName":"Ariadne Conill","fromEmail":"ariadne@dereferenced.org","sentAt":"2019-07-11T17:26:25Z","receivedAt":"2019-07-11T17:26:46Z","isPatch":true,"sender":{"key":"ariadne@dereferenced.org","avatar":"https://avatars.githubusercontent.com/u/1522444?v=4"},"body":"When mailmap is enabled by default or by configuration, it may be\nuseful to override the default behaviour.  Previously, it was\npossible to enable the mailmap feature when it was disabled by\ndefault or in the configuration, but it was not possible to disable\nthe mailmap feature when it was enabled by default or by the\nconfiguration.\n\nThe --no-use-mailmap option equalizes this by allowing the user to\nexplicitly enable or disable the mailmap feature according to their\nrequirements.\n\nSigned-off-by: Ariadne Conill <ariadne@dereferenced.org>\n---\n Documentation/git-log.txt | 5 +++++\n builtin/log.c             | 1 +\n 2 files changed, 6 insertions(+)\n\ndiff --git a/Documentation/git-log.txt b/Documentation/git-log.txt\nindex b02e922dc3..50bc8f7da2 100644\n--- a/Documentation/git-log.txt\n+++ b/Documentation/git-log.txt\n@@ -54,6 +54,11 @@ OPTIONS\n \taddresses to canonical real names and email addresses. See\n \tlinkgit:git-shortlog[1].\n \n+--no-use-mailmap::\n+\tDo not use the mailmap file to map author and commiter names\n+\tand email addresses to canonical real names and email addresses.\n+\tSee linkgit:git-shortlog[1].\n+\n --full-diff::\n \tWithout this flag, `git log -p <path>...` shows commits that\n \ttouch the specified paths, and diffs about the same specified\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 3d2ce8fa3d..a9195bcb34 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -167,6 +167,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,\n \t\tOPT__QUIET(&quiet, N_(\"suppress diff output\")),\n \t\tOPT_BOOL(0, \"source\", &source, N_(\"show source\")),\n \t\tOPT_BOOL(0, \"use-mailmap\", &mailmap, N_(\"Use mail map file\")),\n+\t\tOPT_NEGBIT(0, \"no-use-mailmap\", &mailmap, N_(\"Do not use mail map file\"), 1),\n \t\tOPT_STRING_LIST(0, \"decorate-refs\", &decorate_refs_include,\n \t\t\t\tN_(\"pattern\"), N_(\"only decorate refs that match <pattern>\")),\n \t\tOPT_STRING_LIST(0, \"decorate-refs-exclude\", &decorate_refs_exclude,\n-- \n2.17.1\n\n"},{"id":"378836","messageId":"20190711172626.16480-4-ariadne@dereferenced.org","threadId":"51466","inReplyTo":"20190711172626.16480-1-ariadne@dereferenced.org","subject":"[PATCH v2 3/3] tests: add test for git log --no-use-mailmap","fromName":"Ariadne Conill","fromEmail":"ariadne@dereferenced.org","sentAt":"2019-07-11T17:26:26Z","receivedAt":"2019-07-11T17:26:47Z","isPatch":true,"sender":{"key":"ariadne@dereferenced.org","avatar":"https://avatars.githubusercontent.com/u/1522444?v=4"},"body":"In order to prove that the --no-use-mailmap option works as expected,\nwe add a test for it which runs with -Dlog.mailmap=true to ensure that\nthe option successfully negates the configured default.\n\nSigned-off-by: Ariadne Conill <ariadne@dereferenced.org>\n---\n t/t4203-mailmap.sh | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 43b1522ea2..23a8947bce 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -465,6 +465,14 @@ test_expect_success 'Only grep replaced author with --use-mailmap' '\n \tgit log --use-mailmap --author \"<cto@coompany.xx>\" >actual &&\n \ttest_must_be_empty actual\n '\n+cat >expect <<\\EOF\n+Author: santa <me@company.xx>\n+EOF\n+\n+test_expect_success 'Grep author with --no-use-mailmap + log.mailmap=True' '\n+\tgit -c log.mailmap=True log --no-use-mailmap --author santa | grep Author >actual &&\n+\ttest_cmp expect actual\n+'\n \n # git blame\n cat >expect <<\\EOF\n-- \n2.17.1\n\n"},{"id":"378839","messageId":"f2cd0072-95de-3e60-d860-a5dd2c58c41a@drbeat.li","threadId":"51466","inReplyTo":"20190711172626.16480-4-ariadne@dereferenced.org","subject":"Re: [PATCH v2 3/3] tests: add test for git log --no-use-mailmap","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2019-07-11T17:32:51Z","receivedAt":"2019-07-11T17:33:02Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"On 11.07.19 19:26, Ariadne Conill wrote:\n> In order to prove that the --no-use-mailmap option works as expected,\n> we add a test for it which runs with -Dlog.mailmap=true to ensure that\n\ns/-D/-c /\n\nThis ain't Java :-)\n\n> the option successfully negates the configured default.\n> \n> Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>\n> ---\n>  t/t4203-mailmap.sh | 8 ++++++++\n>  1 file changed, 8 insertions(+)\n> \n> diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\n> index 43b1522ea2..23a8947bce 100755\n> --- a/t/t4203-mailmap.sh\n> +++ b/t/t4203-mailmap.sh\n> @@ -465,6 +465,14 @@ test_expect_success 'Only grep replaced author with --use-mailmap' '\n>  \tgit log --use-mailmap --author \"<cto@coompany.xx>\" >actual &&\n>  \ttest_must_be_empty actual\n>  '\n> +cat >expect <<\\EOF\n> +Author: santa <me@company.xx>\n> +EOF\n> +\n> +test_expect_success 'Grep author with --no-use-mailmap + log.mailmap=True' '\n> +\tgit -c log.mailmap=True log --no-use-mailmap --author santa | grep Author >actual &&\n> +\ttest_cmp expect actual\n> +'\n>  \n>  # git blame\n>  cat >expect <<\\EOF\n> \n\n\nCheers,\nBeat\n"},{"id":"378840","messageId":"CAAOiGNxrkVQy=2OHEJROtH+S_MdUMGCDOnjhgNK_x6iANcGiig@mail.gmail.com","threadId":"51466","inReplyTo":"f2cd0072-95de-3e60-d860-a5dd2c58c41a@drbeat.li","subject":"Re: [PATCH v2 3/3] tests: add test for git log --no-use-mailmap","fromName":"Ariadne Conill","fromEmail":"ariadne@dereferenced.org","sentAt":"2019-07-11T17:38:39Z","receivedAt":"2019-07-11T17:38:52Z","isPatch":true,"sender":{"key":"ariadne@dereferenced.org","avatar":"https://avatars.githubusercontent.com/u/1522444?v=4"},"body":"Hello,\n\nOn Thu, Jul 11, 2019 at 12:32 PM Beat Bolli <dev+git@drbeat.li> wrote:\n>\n> On 11.07.19 19:26, Ariadne Conill wrote:\n> > In order to prove that the --no-use-mailmap option works as expected,\n> > we add a test for it which runs with -Dlog.mailmap=true to ensure that\n>\n> s/-D/-c /\n>\n> This ain't Java :-)\n\nIndeed, it is not.  I thought I caught that when proofreading the\ncommit message.  Will resolve in v3.\n\nThanks for the review!\n\nAriadne\n"},{"id":"378847","messageId":"91cdd139-1dac-e7b5-c51a-ea057c0c31ca@drbeat.li","threadId":"51466","inReplyTo":"20190711172626.16480-3-ariadne@dereferenced.org","subject":"Re: [PATCH v2 2/3] log: add --no-use-mailmap option to complement --use-mailmap option","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2019-07-11T18:24:04Z","receivedAt":"2019-07-11T18:24:14Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"On 11.07.19 19:26, Ariadne Conill wrote:\n> When mailmap is enabled by default or by configuration, it may be\n> useful to override the default behaviour.  Previously, it was\n> possible to enable the mailmap feature when it was disabled by\n> default or in the configuration, but it was not possible to disable\n> the mailmap feature when it was enabled by default or by the\n> configuration.\n> \n> The --no-use-mailmap option equalizes this by allowing the user to\n> explicitly enable or disable the mailmap feature according to their\n> requirements.\n> \n> Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>\n> ---\n>  Documentation/git-log.txt | 5 +++++\n>  builtin/log.c             | 1 +\n>  2 files changed, 6 insertions(+)\n> \n> diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt\n> index b02e922dc3..50bc8f7da2 100644\n> --- a/Documentation/git-log.txt\n> +++ b/Documentation/git-log.txt\n> @@ -54,6 +54,11 @@ OPTIONS\n>  \taddresses to canonical real names and email addresses. See\n>  \tlinkgit:git-shortlog[1].\n>  \n> +--no-use-mailmap::\n> +\tDo not use the mailmap file to map author and commiter names\n> +\tand email addresses to canonical real names and email addresses.\n> +\tSee linkgit:git-shortlog[1].\n> +\n>  --full-diff::\n>  \tWithout this flag, `git log -p <path>...` shows commits that\n>  \ttouch the specified paths, and diffs about the same specified\n> diff --git a/builtin/log.c b/builtin/log.c\n> index 3d2ce8fa3d..a9195bcb34 100644\n> --- a/builtin/log.c\n> +++ b/builtin/log.c\n> @@ -167,6 +167,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,\n>  \t\tOPT__QUIET(&quiet, N_(\"suppress diff output\")),\n>  \t\tOPT_BOOL(0, \"source\", &source, N_(\"show source\")),\n>  \t\tOPT_BOOL(0, \"use-mailmap\", &mailmap, N_(\"Use mail map file\")),\n> +\t\tOPT_NEGBIT(0, \"no-use-mailmap\", &mailmap, N_(\"Do not use mail map file\"), 1),\n\nThis works already. OPT_BOOL automatically handles the negation. You\njust have to add \"[no-]\" to the documentation of --use-mailmap.\n\n>  \t\tOPT_STRING_LIST(0, \"decorate-refs\", &decorate_refs_include,\n>  \t\t\t\tN_(\"pattern\"), N_(\"only decorate refs that match <pattern>\")),\n>  \t\tOPT_STRING_LIST(0, \"decorate-refs-exclude\", &decorate_refs_exclude,\n> \n\nCheers,\nBeat\n"},{"id":"378848","messageId":"CAAOiGNyYyFpdkHXa8fY3OcLsZsiZXb72YUQ294f61EosxdK8Kg@mail.gmail.com","threadId":"51466","inReplyTo":"91cdd139-1dac-e7b5-c51a-ea057c0c31ca@drbeat.li","subject":"Re: [PATCH v2 2/3] log: add --no-use-mailmap option to complement --use-mailmap option","fromName":"Ariadne Conill","fromEmail":"ariadne@dereferenced.org","sentAt":"2019-07-11T18:25:54Z","receivedAt":"2019-07-11T18:26:08Z","isPatch":true,"sender":{"key":"ariadne@dereferenced.org","avatar":"https://avatars.githubusercontent.com/u/1522444?v=4"},"body":"Hello,\n\nOn Thu, Jul 11, 2019 at 1:24 PM Beat Bolli <dev+git@drbeat.li> wrote:\n>\n> On 11.07.19 19:26, Ariadne Conill wrote:\n> > When mailmap is enabled by default or by configuration, it may be\n> > useful to override the default behaviour.  Previously, it was\n> > possible to enable the mailmap feature when it was disabled by\n> > default or in the configuration, but it was not possible to disable\n> > the mailmap feature when it was enabled by default or by the\n> > configuration.\n> >\n> > The --no-use-mailmap option equalizes this by allowing the user to\n> > explicitly enable or disable the mailmap feature according to their\n> > requirements.\n> >\n> > Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>\n> > ---\n> >  Documentation/git-log.txt | 5 +++++\n> >  builtin/log.c             | 1 +\n> >  2 files changed, 6 insertions(+)\n> >\n> > diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt\n> > index b02e922dc3..50bc8f7da2 100644\n> > --- a/Documentation/git-log.txt\n> > +++ b/Documentation/git-log.txt\n> > @@ -54,6 +54,11 @@ OPTIONS\n> >       addresses to canonical real names and email addresses. See\n> >       linkgit:git-shortlog[1].\n> >\n> > +--no-use-mailmap::\n> > +     Do not use the mailmap file to map author and commiter names\n> > +     and email addresses to canonical real names and email addresses.\n> > +     See linkgit:git-shortlog[1].\n> > +\n> >  --full-diff::\n> >       Without this flag, `git log -p <path>...` shows commits that\n> >       touch the specified paths, and diffs about the same specified\n> > diff --git a/builtin/log.c b/builtin/log.c\n> > index 3d2ce8fa3d..a9195bcb34 100644\n> > --- a/builtin/log.c\n> > +++ b/builtin/log.c\n> > @@ -167,6 +167,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,\n> >               OPT__QUIET(&quiet, N_(\"suppress diff output\")),\n> >               OPT_BOOL(0, \"source\", &source, N_(\"show source\")),\n> >               OPT_BOOL(0, \"use-mailmap\", &mailmap, N_(\"Use mail map file\")),\n> > +             OPT_NEGBIT(0, \"no-use-mailmap\", &mailmap, N_(\"Do not use mail map file\"), 1),\n>\n> This works already. OPT_BOOL automatically handles the negation. You\n> just have to add \"[no-]\" to the documentation of --use-mailmap.\n\nAha.  I was expecting it to behave like typical getopt_long() parsing,\nwhere you have to handle this yourself.  No problem.  I'll clean that\nup!  Thanks for the tip.\n\nAriadne\n"},{"id":"378849","messageId":"5859bdb3-ce8e-d428-2e31-46e817a42e0c@drbeat.li","threadId":"51466","inReplyTo":"CAAOiGNyYyFpdkHXa8fY3OcLsZsiZXb72YUQ294f61EosxdK8Kg@mail.gmail.com","subject":"Re: [PATCH v2 2/3] log: add --no-use-mailmap option to complement --use-mailmap option","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2019-07-11T18:27:04Z","receivedAt":"2019-07-11T18:27:11Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"On 11.07.19 20:25, Ariadne Conill wrote:\n> Hello,\n> \n> On Thu, Jul 11, 2019 at 1:24 PM Beat Bolli <dev+git@drbeat.li> wrote:\n>>\n>> On 11.07.19 19:26, Ariadne Conill wrote:\n>>> When mailmap is enabled by default or by configuration, it may be\n>>> useful to override the default behaviour.  Previously, it was\n>>> possible to enable the mailmap feature when it was disabled by\n>>> default or in the configuration, but it was not possible to disable\n>>> the mailmap feature when it was enabled by default or by the\n>>> configuration.\n>>>\n>>> The --no-use-mailmap option equalizes this by allowing the user to\n>>> explicitly enable or disable the mailmap feature according to their\n>>> requirements.\n>>>\n>>> Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>\n>>> ---\n>>>  Documentation/git-log.txt | 5 +++++\n>>>  builtin/log.c             | 1 +\n>>>  2 files changed, 6 insertions(+)\n>>>\n>>> diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt\n>>> index b02e922dc3..50bc8f7da2 100644\n>>> --- a/Documentation/git-log.txt\n>>> +++ b/Documentation/git-log.txt\n>>> @@ -54,6 +54,11 @@ OPTIONS\n>>>       addresses to canonical real names and email addresses. See\n>>>       linkgit:git-shortlog[1].\n>>>\n>>> +--no-use-mailmap::\n>>> +     Do not use the mailmap file to map author and commiter names\n>>> +     and email addresses to canonical real names and email addresses.\n>>> +     See linkgit:git-shortlog[1].\n>>> +\n>>>  --full-diff::\n>>>       Without this flag, `git log -p <path>...` shows commits that\n>>>       touch the specified paths, and diffs about the same specified\n>>> diff --git a/builtin/log.c b/builtin/log.c\n>>> index 3d2ce8fa3d..a9195bcb34 100644\n>>> --- a/builtin/log.c\n>>> +++ b/builtin/log.c\n>>> @@ -167,6 +167,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,\n>>>               OPT__QUIET(&quiet, N_(\"suppress diff output\")),\n>>>               OPT_BOOL(0, \"source\", &source, N_(\"show source\")),\n>>>               OPT_BOOL(0, \"use-mailmap\", &mailmap, N_(\"Use mail map file\")),\n>>> +             OPT_NEGBIT(0, \"no-use-mailmap\", &mailmap, N_(\"Do not use mail map file\"), 1),\n>>\n>> This works already. OPT_BOOL automatically handles the negation. You\n>> just have to add \"[no-]\" to the documentation of --use-mailmap.\n> \n> Aha.  I was expecting it to behave like typical getopt_long() parsing,\n> where you have to handle this yourself.  No problem.  I'll clean that\n> up!  Thanks for the tip.\n> \n> Ariadne\n\nYou're welcome!\n\nBeat\n"}]}