{"thread":{"id":"51467","subject":"[PATCH v3 0/3] use mailmap by default in git log","startedAt":"2019-07-11T18:07:17Z","lastAt":"2019-07-11T18:07:21Z","messageCount":4,"participants":["Ariadne Conill"],"isPatch":true,"patchVersion":3,"patchTotal":3},"messages":[{"id":"378843","messageId":"20190711180644.30417-1-ariadne@dereferenced.org","threadId":"51467","inReplyTo":null,"subject":"[PATCH v3 0/3] use mailmap by default in git log","fromName":"Ariadne Conill","fromEmail":"ariadne@dereferenced.org","sentAt":"2019-07-11T18:06:41Z","receivedAt":"2019-07-11T18:07:17Z","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 3:\n- Rework many mailmap tests to drop redundant `--use-mailmap` and\n  more rigorously test --no-use-mailmap and configuration variants.\n- Typo fixes in the commit messages.\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: rework mailmap tests for git log\n\n Documentation/git-log.txt |  5 ++++\n builtin/log.c             |  3 ++-\n t/t4203-mailmap.sh        | 49 ++++++++++++++++++++++++++++++++-------\n 3 files changed, 48 insertions(+), 9 deletions(-)\n\n-- \n2.17.1\n\n"},{"id":"378844","messageId":"20190711180644.30417-2-ariadne@dereferenced.org","threadId":"51467","inReplyTo":"20190711180644.30417-1-ariadne@dereferenced.org","subject":"[PATCH v3 1/3] log: use mailmap by default","fromName":"Ariadne Conill","fromEmail":"ariadne@dereferenced.org","sentAt":"2019-07-11T18:06:42Z","receivedAt":"2019-07-11T18:07:21Z","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":"378845","messageId":"20190711180644.30417-3-ariadne@dereferenced.org","threadId":"51467","inReplyTo":"20190711180644.30417-1-ariadne@dereferenced.org","subject":"[PATCH v3 2/3] log: add --no-use-mailmap option to complement --use-mailmap option","fromName":"Ariadne Conill","fromEmail":"ariadne@dereferenced.org","sentAt":"2019-07-11T18:06:43Z","receivedAt":"2019-07-11T18:07:21Z","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":"378846","messageId":"20190711180644.30417-4-ariadne@dereferenced.org","threadId":"51467","inReplyTo":"20190711180644.30417-1-ariadne@dereferenced.org","subject":"[PATCH v3 3/3] tests: rework mailmap tests for git log","fromName":"Ariadne Conill","fromEmail":"ariadne@dereferenced.org","sentAt":"2019-07-11T18:06:44Z","receivedAt":"2019-07-11T18:07:21Z","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 -c log.mailmap=true to ensure that\nthe option successfully negates the configured default.\n\nAdditionally, since --use-mailmap is now the default behaviour, we\nremove mentions of --use-mailmap from the tests, since they are\nredundant.  We also rework some tests to explicitly define the\nlog.mailmap variable in both true and false states.\n\nSigned-off-by: Ariadne Conill <ariadne@dereferenced.org>\n---\n t/t4203-mailmap.sh | 49 ++++++++++++++++++++++++++++++++++++++--------\n 1 file changed, 41 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 43b1522ea2..3d6086ff96 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -422,8 +422,8 @@ Author: Some Dude <some@dude.xx>\n Author: A U Thor <author@example.com>\n EOF\n \n-test_expect_success 'Log output with --use-mailmap' '\n-\tgit log --use-mailmap | grep Author >actual &&\n+test_expect_success 'Log output with mailmap enabled (default)' '\n+\tgit log | grep Author >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -437,18 +437,33 @@ Author: Some Dude <some@dude.xx>\n Author: A U Thor <author@example.com>\n EOF\n \n-test_expect_success 'Log output with log.mailmap' '\n+test_expect_success 'Log output with log.mailmap enabled in config' '\n \tgit -c log.mailmap=True log | grep Author >actual &&\n \ttest_cmp expect actual\n '\n \n+cat >expect <<\\EOF\n+Author: CTO <cto@coompany.xx>\n+Author: claus <me@company.xx>\n+Author: santa <me@company.xx>\n+Author: nick2 <nick2@company.xx>\n+Author: nick2 <bugs@company.xx>\n+Author: nick1 <bugs@company.xx>\n+Author: A U Thor <author@example.com>\n+EOF\n+\n+test_expect_success 'Log output with log.mailmap disabled in config' '\n+\tgit -c log.mailmap=False log | grep Author >actual &&\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-\tgit log --use-mailmap --author Santa | grep Author >actual &&\n+test_expect_success 'Grep author with mailmap enabled (default)' '\n+\tgit log --author Santa | grep Author >actual &&\n \ttest_cmp expect actual\n '\n cat >expect <<\\EOF\n@@ -456,16 +471,34 @@ 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+test_expect_success 'Grep author with log.mailmap enabled' '\n \tgit -c log.mailmap=True 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-\tgit log --use-mailmap --author \"<cto@coompany.xx>\" >actual &&\n+test_expect_success 'Grep author with log.mailmap disabled' '\n+\tgit -c log.mailmap=False log --author \"<santa.claus@northpole.xx>\" >actual &&\n+\ttest_must_be_empty actual\n+'\n+\n+test_expect_success 'Grep author with --no-use-mailmap' '\n+\tgit log --no-use-mailmap --author \"<santa.claus@northpole.xx>\" >actual &&\n \ttest_must_be_empty actual\n '\n \n+test_expect_success 'Only grep replaced author with mailmap enabled' '\n+\tgit log --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 ^OBJI (A U Thor     DATE 1) one\n-- \n2.17.1\n\n"}]}