{"thread":{"id":"60435","subject":"[PATCH 0/2] pretty: add %aA to show domain-part of email addresses","startedAt":"2023-10-26T23:16:12Z","lastAt":"2023-12-10T21:07:24Z","messageCount":21,"participants":["Liam Beguin","Kousik Sanagavarapu","Junio C Hamano","Jeff King","Andy Koppe","Oswald Buddenhagen"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"483945","messageId":"20231026-pretty-email-domain-v1-0-5d6bfa6615c0@gmail.com","threadId":"60435","inReplyTo":null,"subject":"[PATCH 0/2] pretty: add %aA to show domain-part of email addresses","fromName":"Liam Beguin","fromEmail":"liambeguin@gmail.com","sentAt":"2023-10-26T23:16:03Z","receivedAt":"2023-10-26T23:16:12Z","isPatch":true,"sender":{"key":"liambeguin@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3811160?v=4"},"body":"Many reports use the email domain to keep track of organizations\ncontributing to projects.\nAdd support for formatting the domain-part of a contributor's address so\nthat this can be done using git itself, with something like:\n\ngit shortlog -sn --group=format:%aA v2.41.0..v2.42.0\n\n---\nLiam Beguin (2):\n      doc: pretty-formats: add missing word\n      pretty: add '%aA' to show domain-part of email addresses\n\n Documentation/pretty-formats.txt | 10 ++++++++--\n pretty.c                         | 13 ++++++++++++-\n t/t4203-mailmap.sh               | 28 ++++++++++++++++++++++++++++\n t/t6006-rev-list-format.sh       |  6 ++++--\n 4 files changed, 52 insertions(+), 5 deletions(-)\n---\nbase-commit: 2e8e77cbac8ac17f94eee2087187fa1718e38b14\nchange-id: 20231025-pretty-email-domain-2eb2ae23f416\n\nBest regards,\n-- \nLiam Beguin <liambeguin@gmail.com>\n\n"},{"id":"483946","messageId":"20231026-pretty-email-domain-v1-1-5d6bfa6615c0@gmail.com","threadId":"60435","inReplyTo":"20231026-pretty-email-domain-v1-0-5d6bfa6615c0@gmail.com","subject":"[PATCH 1/2] doc: pretty-formats: add missing word","fromName":"Liam Beguin","fromEmail":"liambeguin@gmail.com","sentAt":"2023-10-26T23:16:04Z","receivedAt":"2023-10-26T23:16:13Z","isPatch":true,"sender":{"key":"liambeguin@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3811160?v=4"},"body":"Follow %al and %cl and make sure to mention it's the 'email' local-part.\n\nSigned-off-by: Liam Beguin <liambeguin@gmail.com>\n---\n Documentation/pretty-formats.txt | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\nindex d38b4ab5666c..a22f6fceecdd 100644\n--- a/Documentation/pretty-formats.txt\n+++ b/Documentation/pretty-formats.txt\n@@ -193,7 +193,7 @@ The placeholders are:\n '%aE':: author email (respecting .mailmap, see linkgit:git-shortlog[1]\n \tor linkgit:git-blame[1])\n '%al':: author email local-part (the part before the '@' sign)\n-'%aL':: author local-part (see '%al') respecting .mailmap, see\n+'%aL':: author email local-part (see '%al') respecting .mailmap, see\n \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n '%ad':: author date (format respects --date= option)\n '%aD':: author date, RFC2822 style\n@@ -211,7 +211,7 @@ The placeholders are:\n '%cE':: committer email (respecting .mailmap, see\n \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n '%cl':: committer email local-part (the part before the '@' sign)\n-'%cL':: committer local-part (see '%cl') respecting .mailmap, see\n+'%cL':: committer email local-part (see '%cl') respecting .mailmap, see\n \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n '%cd':: committer date (format respects --date= option)\n '%cD':: committer date, RFC2822 style\n\n-- \n2.39.0\n\n"},{"id":"483947","messageId":"20231026-pretty-email-domain-v1-2-5d6bfa6615c0@gmail.com","threadId":"60435","inReplyTo":"20231026-pretty-email-domain-v1-0-5d6bfa6615c0@gmail.com","subject":"[PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Liam Beguin","fromEmail":"liambeguin@gmail.com","sentAt":"2023-10-26T23:16:05Z","receivedAt":"2023-10-26T23:16:14Z","isPatch":true,"sender":{"key":"liambeguin@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3811160?v=4"},"body":"Many reports use the email domain to keep track of organizations\ncontributing to projects.\nAdd support for formatting the domain-part of a contributor's address so\nthat this can be done using git itself, with something like:\n\n\tgit shortlog -sn --group=format:%aA v2.41.0..v2.42.0\n\nSigned-off-by: Liam Beguin <liambeguin@gmail.com>\n---\n Documentation/pretty-formats.txt |  6 ++++++\n pretty.c                         | 13 ++++++++++++-\n t/t4203-mailmap.sh               | 28 ++++++++++++++++++++++++++++\n t/t6006-rev-list-format.sh       |  6 ++++--\n 4 files changed, 50 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\nindex a22f6fceecdd..72102a681c3a 100644\n--- a/Documentation/pretty-formats.txt\n+++ b/Documentation/pretty-formats.txt\n@@ -195,6 +195,9 @@ The placeholders are:\n '%al':: author email local-part (the part before the '@' sign)\n '%aL':: author email local-part (see '%al') respecting .mailmap, see\n \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n+'%aa':: author email domain-part (the part after the '@' sign)\n+'%aA':: author email domain-part (see '%al') respecting .mailmap, see\n+\tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n '%ad':: author date (format respects --date= option)\n '%aD':: author date, RFC2822 style\n '%ar':: author date, relative\n@@ -213,6 +216,9 @@ The placeholders are:\n '%cl':: committer email local-part (the part before the '@' sign)\n '%cL':: committer email local-part (see '%cl') respecting .mailmap, see\n \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n+'%ca':: committer email domain-part (the part before the '@' sign)\n+'%cA':: committer email domain-part (see '%cl') respecting .mailmap, see\n+\tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n '%cd':: committer date (format respects --date= option)\n '%cD':: committer date, RFC2822 style\n '%cr':: committer date, relative\ndiff --git a/pretty.c b/pretty.c\nindex cf964b060cd1..4f5d081589ea 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -791,7 +791,7 @@ static size_t format_person_part(struct strbuf *sb, char part,\n \tmail = s.mail_begin;\n \tmaillen = s.mail_end - s.mail_begin;\n \n-\tif (part == 'N' || part == 'E' || part == 'L') /* mailmap lookup */\n+\tif (part == 'N' || part == 'E' || part == 'L' || part == 'A') /* mailmap lookup */\n \t\tmailmap_name(&mail, &maillen, &name, &namelen);\n \tif (part == 'n' || part == 'N') {\t/* name */\n \t\tstrbuf_add(sb, name, namelen);\n@@ -808,6 +808,17 @@ static size_t format_person_part(struct strbuf *sb, char part,\n \t\tstrbuf_add(sb, mail, maillen);\n \t\treturn placeholder_len;\n \t}\n+\tif (part == 'a' || part == 'A') {\t/* domain-part */\n+\t\tconst char *at = memchr(mail, '@', maillen);\n+\t\tif (at) {\n+\t\t\tat += 1;\n+\t\t\tmaillen -= at - mail;\n+\t\t\tstrbuf_add(sb, at, maillen);\n+\t\t} else {\n+\t\t\tstrbuf_add(sb, mail, maillen);\n+\t\t}\n+\t\treturn placeholder_len;\n+\t}\n \n \tif (!s.date_begin)\n \t\tgoto skip;\ndiff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\nindex 2016132f5161..35bf7bb05bea 100755\n--- a/t/t4203-mailmap.sh\n+++ b/t/t4203-mailmap.sh\n@@ -624,6 +624,34 @@ test_expect_success 'Log output (local-part email address)' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'Log output (domain-part email address)' '\n+\tcat >expect <<-EOF &&\n+\tAuthor email cto@coompany.xx has domain-part coompany.xx\n+\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n+\n+\tAuthor email me@company.xx has domain-part company.xx\n+\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n+\n+\tAuthor email me@company.xx has domain-part company.xx\n+\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n+\n+\tAuthor email nick2@company.xx has domain-part company.xx\n+\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n+\n+\tAuthor email bugs@company.xx has domain-part company.xx\n+\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n+\n+\tAuthor email bugs@company.xx has domain-part company.xx\n+\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n+\n+\tAuthor email author@example.com has domain-part example.com\n+\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n+\tEOF\n+\n+\tgit log --pretty=format:\"Author email %ae has domain-part %aa%nCommitter email %ce has domain-part %ca%n\" >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_expect_success 'Log output with --use-mailmap' '\n \ttest_config mailmap.file complex.map &&\n \ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 573eb97a0f7f..34c686becf2d 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -163,11 +163,12 @@ commit $head1\n EOF\n \n # we don't test relative here\n-test_format author %an%n%ae%n%al%n%ad%n%aD%n%at <<EOF\n+test_format author %an%n%ae%n%al%aa%n%ad%n%aD%n%at <<EOF\n commit $head2\n $GIT_AUTHOR_NAME\n $GIT_AUTHOR_EMAIL\n $TEST_AUTHOR_LOCALNAME\n+$TEST_AUTHOR_DOMAIN\n Thu Apr 7 15:13:13 2005 -0700\n Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n@@ -180,11 +181,12 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format committer %cn%n%ce%n%cl%n%cd%n%cD%n%ct <<EOF\n+test_format committer %cn%n%ce%n%cl%ca%n%cd%n%cD%n%ct <<EOF\n commit $head2\n $GIT_COMMITTER_NAME\n $GIT_COMMITTER_EMAIL\n $TEST_COMMITTER_LOCALNAME\n+$TEST_COMMITTER_DOMAIN\n Thu Apr 7 15:13:13 2005 -0700\n Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n\n-- \n2.39.0\n\n"},{"id":"484001","messageId":"20231027184357.21049-1-five231003@gmail.com","threadId":"60435","inReplyTo":"20231026-pretty-email-domain-v1-2-5d6bfa6615c0@gmail.com","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Kousik Sanagavarapu","fromEmail":"five231003@gmail.com","sentAt":"2023-10-27T18:40:30Z","receivedAt":"2023-10-27T18:44:03Z","isPatch":true,"sender":{"key":"five231003@gmail.com","avatar":"https://avatars.githubusercontent.com/u/75560439?v=4"},"body":"Hi Liam,\n\nLiam Beguin <liambeguin@gmail.com> wrote:\n> Subject: Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses\n\nSince we are adding both '%aa' and '%aA', it would be better to\nto include both in the commit subject, but since it is already long\nenough, in my opinion\n\n\tpretty: add formats for domain-part of email address\n\nwould convey the gist of the commit to the reader better.\n\n> Many reports use the email domain to keep track of organizations\n> contributing to projects.\n> Add support for formatting the domain-part of a contributor's address so\n> that this can be done using git itself, with something like:\n> \n> \tgit shortlog -sn --group=format:%aA v2.41.0..v2.42.0\n> \n> Signed-off-by: Liam Beguin <liambeguin@gmail.com>\n\nA very very very minor nit but the commit message would read better as\n\n\t... contributing to projects, so add support for ...\n\nFeel free to ignore it.\n\n> ---\n>  Documentation/pretty-formats.txt |  6 ++++++\n>  pretty.c                         | 13 ++++++++++++-\n>  t/t4203-mailmap.sh               | 28 ++++++++++++++++++++++++++++\n>  t/t6006-rev-list-format.sh       |  6 ++++--\n>  4 files changed, 50 insertions(+), 3 deletions(-)\n> \n> diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\n> index a22f6fceecdd..72102a681c3a 100644\n> --- a/Documentation/pretty-formats.txt\n> +++ b/Documentation/pretty-formats.txt\n> @@ -195,6 +195,9 @@ The placeholders are:\n>  '%al':: author email local-part (the part before the '@' sign)\n>  '%aL':: author email local-part (see '%al') respecting .mailmap, see\n>  \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n> +'%aa':: author email domain-part (the part after the '@' sign)\n> +'%aA':: author email domain-part (see '%al') respecting .mailmap, see\n> +\tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n>  '%ad':: author date (format respects --date= option)\n>  '%aD':: author date, RFC2822 style\n>  '%ar':: author date, relative\n> @@ -213,6 +216,9 @@ The placeholders are:\n>  '%cl':: committer email local-part (the part before the '@' sign)\n>  '%cL':: committer email local-part (see '%cl') respecting .mailmap, see\n>  \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n> +'%ca':: committer email domain-part (the part before the '@' sign)\n> +'%cA':: committer email domain-part (see '%cl') respecting .mailmap, see\n> +\tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n>  '%cd':: committer date (format respects --date= option)\n>  '%cD':: committer date, RFC2822 style\n>  '%cr':: committer date, relative\n> diff --git a/pretty.c b/pretty.c\n> index cf964b060cd1..4f5d081589ea 100644\n> --- a/pretty.c\n> +++ b/pretty.c\n> @@ -791,7 +791,7 @@ static size_t format_person_part(struct strbuf *sb, char part,\n>  \tmail = s.mail_begin;\n>  \tmaillen = s.mail_end - s.mail_begin;\n>  \n> -\tif (part == 'N' || part == 'E' || part == 'L') /* mailmap lookup */\n> +\tif (part == 'N' || part == 'E' || part == 'L' || part == 'A') /* mailmap lookup */\n>  \t\tmailmap_name(&mail, &maillen, &name, &namelen);\n>  \tif (part == 'n' || part == 'N') {\t/* name */\n>  \t\tstrbuf_add(sb, name, namelen);\n> @@ -808,6 +808,17 @@ static size_t format_person_part(struct strbuf *sb, char part,\n>  \t\tstrbuf_add(sb, mail, maillen);\n>  \t\treturn placeholder_len;\n>  \t}\n> +\tif (part == 'a' || part == 'A') {\t/* domain-part */\n> +\t\tconst char *at = memchr(mail, '@', maillen);\n> +\t\tif (at) {\n> +\t\t\tat += 1;\n> +\t\t\tmaillen -= at - mail;\n> +\t\t\tstrbuf_add(sb, at, maillen);\n> +\t\t} else {\n> +\t\t\tstrbuf_add(sb, mail, maillen);\n> +\t\t}\n> +\t\treturn placeholder_len;\n> +\t}\n>  \n>  \tif (!s.date_begin)\n>  \t\tgoto skip;\n\nSo, if we have a domain-name, we grab it, else (the case where we don't\nhave '@') we grab it as-is. Looks good.\n\n> diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\n> index 2016132f5161..35bf7bb05bea 100755\n> --- a/t/t4203-mailmap.sh\n> +++ b/t/t4203-mailmap.sh\n> @@ -624,6 +624,34 @@ test_expect_success 'Log output (local-part email address)' '\n>  \ttest_cmp expect actual\n>  '\n>  \n> +test_expect_success 'Log output (domain-part email address)' '\n> +\tcat >expect <<-EOF &&\n> +\tAuthor email cto@coompany.xx has domain-part coompany.xx\n> +\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n> +\n> +\tAuthor email me@company.xx has domain-part company.xx\n> +\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n> +\n> +\tAuthor email me@company.xx has domain-part company.xx\n> +\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n> +\n> +\tAuthor email nick2@company.xx has domain-part company.xx\n> +\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n> +\n> +\tAuthor email bugs@company.xx has domain-part company.xx\n> +\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n> +\n> +\tAuthor email bugs@company.xx has domain-part company.xx\n> +\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n> +\n> +\tAuthor email author@example.com has domain-part example.com\n> +\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n> +\tEOF\n> +\n> +\tgit log --pretty=format:\"Author email %ae has domain-part %aa%nCommitter email %ce has domain-part %ca%n\" >actual &&\n> +\ttest_cmp expect actual\n> +'\n> +\n>  test_expect_success 'Log output with --use-mailmap' '\n>  \ttest_config mailmap.file complex.map &&\n>  \n> diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\n> index 573eb97a0f7f..34c686becf2d 100755\n> --- a/t/t6006-rev-list-format.sh\n> +++ b/t/t6006-rev-list-format.sh\n> @@ -163,11 +163,12 @@ commit $head1\n>  EOF\n>  \n>  # we don't test relative here\n> -test_format author %an%n%ae%n%al%n%ad%n%aD%n%at <<EOF\n> +test_format author %an%n%ae%n%al%aa%n%ad%n%aD%n%at <<EOF\n>  commit $head2\n>  $GIT_AUTHOR_NAME\n>  $GIT_AUTHOR_EMAIL\n>  $TEST_AUTHOR_LOCALNAME\n> +$TEST_AUTHOR_DOMAIN\n>  Thu Apr 7 15:13:13 2005 -0700\n>  Thu, 7 Apr 2005 15:13:13 -0700\n>  1112911993\n> @@ -180,11 +181,12 @@ Thu, 7 Apr 2005 15:13:13 -0700\n>  1112911993\n>  EOF\n>  \n> -test_format committer %cn%n%ce%n%cl%n%cd%n%cD%n%ct <<EOF\n> +test_format committer %cn%n%ce%n%cl%ca%n%cd%n%cD%n%ct <<EOF\n>  commit $head2\n>  $GIT_COMMITTER_NAME\n>  $GIT_COMMITTER_EMAIL\n>  $TEST_COMMITTER_LOCALNAME\n> +$TEST_COMMITTER_DOMAIN\n>  Thu Apr 7 15:13:13 2005 -0700\n>  Thu, 7 Apr 2005 15:13:13 -0700\n>  1112911993\n> \n> -- \n> 2.39.0\n\nThe tests look good too.\n\nI should say I'm skeptical of the new format's name though. I know '%ad' is\ntaken... but maybe it's just me.\n\nThanks\n"},{"id":"484011","messageId":"xmqq7cn7obah.fsf@gitster.g","threadId":"60435","inReplyTo":"20231027184357.21049-1-five231003@gmail.com","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-10-28T00:12:06Z","receivedAt":"2023-10-28T00:12:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kousik Sanagavarapu <five231003@gmail.com> writes:\n\n> Liam Beguin <liambeguin@gmail.com> wrote:\n>> Subject: Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses\n>\n> Since we are adding both '%aa' and '%aA', it would be better to\n> to include both in the commit subject, but since it is already long\n> enough, in my opinion\n>\n> \tpretty: add formats for domain-part of email address\n>\n> would convey the gist of the commit to the reader better.\n\n;-).  Very good.\n\n>> Many reports use the email domain to keep track of organizations\n>> contributing to projects.\n\nGrouping @gmail.com addresses do not smell all that useful, though.\n\nMore importantly, it is not clear what \"Many reports\" refers to.  If\nthey are *not* verbatim output from \"git log\" family of commands,\niow, they are produced by post-processing output from \"git log\"\nfamily of commands, then I do not quite see why %aa is useful at\nall.\n\nThanks.\n"},{"id":"484012","messageId":"20231028021301.GA35796@coredump.intra.peff.net","threadId":"60435","inReplyTo":"xmqq7cn7obah.fsf@gitster.g","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-10-28T02:13:01Z","receivedAt":"2023-10-28T02:13:05Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Oct 28, 2023 at 09:12:06AM +0900, Junio C Hamano wrote:\n\n> Grouping @gmail.com addresses do not smell all that useful, though.\n> \n> More importantly, it is not clear what \"Many reports\" refers to.  If\n> they are *not* verbatim output from \"git log\" family of commands,\n> iow, they are produced by post-processing output from \"git log\"\n> family of commands, then I do not quite see why %aa is useful at\n> all.\n\nOne way you could directly use this is in shortlog, which these days\nlets you group by specific formats. So:\n\n  git shortlog -ns --group=format:%aA\n\nis potentially useful.\n\nI say \"potentially\" because it really depends on your project and its\ncontributors. In git.git the results are mostly either too broad\n(\"gmail.com\" covers many unrelated people) or too narrow (I'll assume\nI'm the only contributor from \"peff.net\"). There are a few possibly\nuseful ones (\"microsoft.com\", \"gitlab.com\", though even those are\nmisleading because email domains don't always correspond to\naffiliations).\n\nSo I don't find it useful myself, but I see how it could be in the right\ncircumstances. It also feels like a symmetric match to \"%al\", which\nalready exists. I do find \"aa\" as the identifier a little hard to\nremember. I guess it's \"a\" for \"address\", though I'd have called the\nwhole local@domain thing an address thing that. Of course \"d\" for domain\nwould make sense, but that is already taken. If we could spell it as\n%(authoremail:domain) that would remove the question. But given the\nexistence of \"%al\", I'm not too sad to see another letter allocated to\nthis purpose in the meantime.\n\nJust my two cents as a shortlog --format afficionado. ;) (Of course,\nshortlog itself is the ultimate \"you could really just post-process log\noutput\" example).\n\n-Peff\n"},{"id":"484013","messageId":"20231028022048.GA1784118@shaak","threadId":"60435","inReplyTo":"20231027184357.21049-1-five231003@gmail.com","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Liam Beguin","fromEmail":"liambeguin@gmail.com","sentAt":"2023-10-28T02:20:48Z","receivedAt":"2023-10-28T02:20:53Z","isPatch":true,"sender":{"key":"liambeguin@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3811160?v=4"},"body":"Hi Kousik,\n\nOn Sat, Oct 28, 2023 at 12:10:30AM +0530, Kousik Sanagavarapu wrote:\n> Hi Liam,\n> \n> Liam Beguin <liambeguin@gmail.com> wrote:\n> > Subject: Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses\n> \n> Since we are adding both '%aa' and '%aA', it would be better to\n> to include both in the commit subject, but since it is already long\n> enough, in my opinion\n> \n> \tpretty: add formats for domain-part of email address\n> \n> would convey the gist of the commit to the reader better.\n\nThat reads better, I'll update the commit message.\n\n> > Many reports use the email domain to keep track of organizations\n> > contributing to projects.\n> > Add support for formatting the domain-part of a contributor's address so\n> > that this can be done using git itself, with something like:\n> > \n> > \tgit shortlog -sn --group=format:%aA v2.41.0..v2.42.0\n> > \n> > Signed-off-by: Liam Beguin <liambeguin@gmail.com>\n> \n> A very very very minor nit but the commit message would read better as\n> \n> \t... contributing to projects, so add support for ...\n> \n> Feel free to ignore it.\n> \n> > ---\n> >  Documentation/pretty-formats.txt |  6 ++++++\n> >  pretty.c                         | 13 ++++++++++++-\n> >  t/t4203-mailmap.sh               | 28 ++++++++++++++++++++++++++++\n> >  t/t6006-rev-list-format.sh       |  6 ++++--\n> >  4 files changed, 50 insertions(+), 3 deletions(-)\n> > \n> > diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt\n> > index a22f6fceecdd..72102a681c3a 100644\n> > --- a/Documentation/pretty-formats.txt\n> > +++ b/Documentation/pretty-formats.txt\n> > @@ -195,6 +195,9 @@ The placeholders are:\n> >  '%al':: author email local-part (the part before the '@' sign)\n> >  '%aL':: author email local-part (see '%al') respecting .mailmap, see\n> >  \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n> > +'%aa':: author email domain-part (the part after the '@' sign)\n> > +'%aA':: author email domain-part (see '%al') respecting .mailmap, see\n> > +\tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n> >  '%ad':: author date (format respects --date= option)\n> >  '%aD':: author date, RFC2822 style\n> >  '%ar':: author date, relative\n> > @@ -213,6 +216,9 @@ The placeholders are:\n> >  '%cl':: committer email local-part (the part before the '@' sign)\n> >  '%cL':: committer email local-part (see '%cl') respecting .mailmap, see\n> >  \tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n> > +'%ca':: committer email domain-part (the part before the '@' sign)\n> > +'%cA':: committer email domain-part (see '%cl') respecting .mailmap, see\n> > +\tlinkgit:git-shortlog[1] or linkgit:git-blame[1])\n> >  '%cd':: committer date (format respects --date= option)\n> >  '%cD':: committer date, RFC2822 style\n> >  '%cr':: committer date, relative\n> > diff --git a/pretty.c b/pretty.c\n> > index cf964b060cd1..4f5d081589ea 100644\n> > --- a/pretty.c\n> > +++ b/pretty.c\n> > @@ -791,7 +791,7 @@ static size_t format_person_part(struct strbuf *sb, char part,\n> >  \tmail = s.mail_begin;\n> >  \tmaillen = s.mail_end - s.mail_begin;\n> >  \n> > -\tif (part == 'N' || part == 'E' || part == 'L') /* mailmap lookup */\n> > +\tif (part == 'N' || part == 'E' || part == 'L' || part == 'A') /* mailmap lookup */\n> >  \t\tmailmap_name(&mail, &maillen, &name, &namelen);\n> >  \tif (part == 'n' || part == 'N') {\t/* name */\n> >  \t\tstrbuf_add(sb, name, namelen);\n> > @@ -808,6 +808,17 @@ static size_t format_person_part(struct strbuf *sb, char part,\n> >  \t\tstrbuf_add(sb, mail, maillen);\n> >  \t\treturn placeholder_len;\n> >  \t}\n> > +\tif (part == 'a' || part == 'A') {\t/* domain-part */\n> > +\t\tconst char *at = memchr(mail, '@', maillen);\n> > +\t\tif (at) {\n> > +\t\t\tat += 1;\n> > +\t\t\tmaillen -= at - mail;\n> > +\t\t\tstrbuf_add(sb, at, maillen);\n> > +\t\t} else {\n> > +\t\t\tstrbuf_add(sb, mail, maillen);\n> > +\t\t}\n> > +\t\treturn placeholder_len;\n> > +\t}\n> >  \n> >  \tif (!s.date_begin)\n> >  \t\tgoto skip;\n> \n> So, if we have a domain-name, we grab it, else (the case where we don't\n> have '@') we grab it as-is. Looks good.\n> \n> > diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh\n> > index 2016132f5161..35bf7bb05bea 100755\n> > --- a/t/t4203-mailmap.sh\n> > +++ b/t/t4203-mailmap.sh\n> > @@ -624,6 +624,34 @@ test_expect_success 'Log output (local-part email address)' '\n> >  \ttest_cmp expect actual\n> >  '\n> >  \n> > +test_expect_success 'Log output (domain-part email address)' '\n> > +\tcat >expect <<-EOF &&\n> > +\tAuthor email cto@coompany.xx has domain-part coompany.xx\n> > +\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n> > +\n> > +\tAuthor email me@company.xx has domain-part company.xx\n> > +\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n> > +\n> > +\tAuthor email me@company.xx has domain-part company.xx\n> > +\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n> > +\n> > +\tAuthor email nick2@company.xx has domain-part company.xx\n> > +\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n> > +\n> > +\tAuthor email bugs@company.xx has domain-part company.xx\n> > +\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n> > +\n> > +\tAuthor email bugs@company.xx has domain-part company.xx\n> > +\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n> > +\n> > +\tAuthor email author@example.com has domain-part example.com\n> > +\tCommitter email $GIT_COMMITTER_EMAIL has domain-part $TEST_COMMITTER_DOMAIN\n> > +\tEOF\n> > +\n> > +\tgit log --pretty=format:\"Author email %ae has domain-part %aa%nCommitter email %ce has domain-part %ca%n\" >actual &&\n> > +\ttest_cmp expect actual\n> > +'\n> > +\n> >  test_expect_success 'Log output with --use-mailmap' '\n> >  \ttest_config mailmap.file complex.map &&\n> >  \n> > diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\n> > index 573eb97a0f7f..34c686becf2d 100755\n> > --- a/t/t6006-rev-list-format.sh\n> > +++ b/t/t6006-rev-list-format.sh\n> > @@ -163,11 +163,12 @@ commit $head1\n> >  EOF\n> >  \n> >  # we don't test relative here\n> > -test_format author %an%n%ae%n%al%n%ad%n%aD%n%at <<EOF\n> > +test_format author %an%n%ae%n%al%aa%n%ad%n%aD%n%at <<EOF\n> >  commit $head2\n> >  $GIT_AUTHOR_NAME\n> >  $GIT_AUTHOR_EMAIL\n> >  $TEST_AUTHOR_LOCALNAME\n> > +$TEST_AUTHOR_DOMAIN\n> >  Thu Apr 7 15:13:13 2005 -0700\n> >  Thu, 7 Apr 2005 15:13:13 -0700\n> >  1112911993\n> > @@ -180,11 +181,12 @@ Thu, 7 Apr 2005 15:13:13 -0700\n> >  1112911993\n> >  EOF\n> >  \n> > -test_format committer %cn%n%ce%n%cl%n%cd%n%cD%n%ct <<EOF\n> > +test_format committer %cn%n%ce%n%cl%ca%n%cd%n%cD%n%ct <<EOF\n> >  commit $head2\n> >  $GIT_COMMITTER_NAME\n> >  $GIT_COMMITTER_EMAIL\n> >  $TEST_COMMITTER_LOCALNAME\n> > +$TEST_COMMITTER_DOMAIN\n> >  Thu Apr 7 15:13:13 2005 -0700\n> >  Thu, 7 Apr 2005 15:13:13 -0700\n> >  1112911993\n> > \n> > -- \n> > 2.39.0\n> \n> The tests look good too.\n> \n> I should say I'm skeptical of the new format's name though. I know '%ad' is\n> taken... but maybe it's just me.\n> \n> Thanks\n\nI agree, %aa isn't the best, I'm definitly opened to suggestions.\nMy preference would've been for something like %ad, but that's already\ntaken.\n\nThanks for reviewing.\n\nCheers,\nLiam\n"},{"id":"484015","messageId":"20231028032221.GB1784118@shaak","threadId":"60435","inReplyTo":"20231028021301.GA35796@coredump.intra.peff.net","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Liam Beguin","fromEmail":"liambeguin@gmail.com","sentAt":"2023-10-28T03:22:21Z","receivedAt":"2023-10-28T03:22:26Z","isPatch":true,"sender":{"key":"liambeguin@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3811160?v=4"},"body":"Hi Junio, Peff,\n\nOn Fri, Oct 27, 2023 at 10:13:01PM -0400, Jeff King wrote:\n> On Sat, Oct 28, 2023 at 09:12:06AM +0900, Junio C Hamano wrote:\n> \n> > Grouping @gmail.com addresses do not smell all that useful, though.\n\nWhile I agree with you, I think that's more an exception that the rule.\n\n> > More importantly, it is not clear what \"Many reports\" refers to.  If\n> > they are *not* verbatim output from \"git log\" family of commands,\n> > iow, they are produced by post-processing output from \"git log\"\n> > family of commands, then I do not quite see why %aa is useful at\n> > all.\n\nI might've been a bit generous with \"many report\", I was mostly thinking\nof the ones published by lwn.net, and U-Boot for example.\n\nTo some extent, \"git shortlog\" could be considered a part of that\npost-processing chain.\n\n> One way you could directly use this is in shortlog, which these days\n> lets you group by specific formats. So:\n> \n>   git shortlog -ns --group=format:%aA\n\nThat's exactly what I implemented this for :-)\n\n> is potentially useful.\n> \n> I say \"potentially\" because it really depends on your project and its\n> contributors. In git.git the results are mostly either too broad\n> (\"gmail.com\" covers many unrelated people) or too narrow (I'll assume\n> I'm the only contributor from \"peff.net\"). There are a few possibly\n> useful ones (\"microsoft.com\", \"gitlab.com\", though even those are\n> misleading because email domains don't always correspond to\n> affiliations).\n\nI agree with your comment here, while grouping everything under\n\"gmail.com\" for example doesn't provide anything really useful we can\nrely on mailmap to fix that when appropriate. I think it would otherwise\ncount as unaffiliated.\n\nI don't claim this to be foolproof, but I do think that it gives a good\noverall view of which companies are involved in the project for the most\npart.\n\n> So I don't find it useful myself, but I see how it could be in the right\n> circumstances. It also feels like a symmetric match to \"%al\", which\n> already exists. I do find \"aa\" as the identifier a little hard to\n> remember. I guess it's \"a\" for \"address\", though I'd have called the\n> whole local@domain thing an address thing that. Of course \"d\" for domain\n> would make sense, but that is already taken. If we could spell it as\n> %(authoremail:domain) that would remove the question. But given the\n> existence of \"%al\", I'm not too sad to see another letter allocated to\n> this purpose in the meantime.\n\nI chose the \"a\" for \"address\", but I'm not sold on %aa either.\nI just couldn't find anything better that wasn't already taken.\n\nWhat about \"a@\"?\n\nIt's a bit easier to remember, being the first character of the\ndomain-part.\n\n> Just my two cents as a shortlog --format afficionado. ;) (Of course,\n> shortlog itself is the ultimate \"you could really just post-process log\n> output\" example).\n\nI'm a big fan of shortlog --format (and --group) as well!\n\nTaking it a step further, it's also possible to pass in whatever mailmap\nyou want to generate a \"report\".  Let's say there's mapping that only\nmakes sense for a single release something like this could be used:\n\ngit -c mailmap.file=git-mailmap-v2.42 shortlog -sn --group=format:%aA\n\n> -Peff\n\nThanks for your time.\n\nCheers,\nLiam\n"},{"id":"484017","messageId":"9a1e3e90-3e94-41fa-897d-5c64c4a42871@gmail.com","threadId":"60435","inReplyTo":"20231028032221.GB1784118@shaak","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Andy Koppe","fromEmail":"andy.koppe@gmail.com","sentAt":"2023-10-28T06:58:31Z","receivedAt":"2023-10-28T06:58:37Z","isPatch":true,"sender":{"key":"andy.koppe@gmail.com","avatar":"https://avatars.githubusercontent.com/u/223411?v=4"},"body":"On 28/10/2023 04:22, Liam Beguin wrote:\n> On Fri, Oct 27, 2023 at 10:13:01PM -0400, Jeff King wrote:\n>> One way you could directly use this is in shortlog, which these days\n>> lets you group by specific formats. So:\n>>\n>>    git shortlog -ns --group=format:%aA\n> \n> That's exactly what I implemented this for :-)\n\nAnother potential use case is custom log formats where one might want to \ncolor the local-part separately from the domain part.\n\n>> It also feels like a symmetric match to \"%al\", which already exists.\n\nSpeaking of symmetry, I think it would need \"%c\" counterparts for the \ncoloring use case.\n\n> I chose the \"a\" for \"address\", but I'm not sold on %aa either.\n> I just couldn't find anything better that wasn't already taken.\n> \n> What about \"a@\"?\n\nMakes sense, and I suppose there's \"%G?\" as precedent for using a symbol \nrather than letter in these.\n\nIf that's not suitable though, how about \"m\" for \"mail domain\"? It also \nimmediately follows \"l\" for \"local-part\" in the alphabet.\n\nRegards,\nAndy\n"},{"id":"484018","messageId":"fe58af57-e84d-4872-ab88-0b228699e5b5@gmail.com","threadId":"60435","inReplyTo":"9a1e3e90-3e94-41fa-897d-5c64c4a42871@gmail.com","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Andy Koppe","fromEmail":"andy.koppe@gmail.com","sentAt":"2023-10-28T07:02:47Z","receivedAt":"2023-10-28T07:02:52Z","isPatch":true,"sender":{"key":"andy.koppe@gmail.com","avatar":"https://avatars.githubusercontent.com/u/223411?v=4"},"body":"On 28/10/2023 07:58, Andy Koppe wrote:\n> On 28/10/2023 04:22, Liam Beguin wrote:\n>> On Fri, Oct 27, 2023 at 10:13:01PM -0400, Jeff King wrote:\n>>> One way you could directly use this is in shortlog, which these days\n>>> lets you group by specific formats. So:\n>>>\n>>>    git shortlog -ns --group=format:%aA\n>>\n>> That's exactly what I implemented this for :-)\n> \n> Another potential use case is custom log formats where one might want to \n> color the local-part separately from the domain part.\n> \n>>> It also feels like a symmetric match to \"%al\", which already exists.\n> \n> Speaking of symmetry, I think it would need \"%c\" counterparts for the \n> coloring use case.\n\nD'oh, it always helps to read the actual patches, which do have the %c \nvariants.\n\nThanks,\nAndy\n"},{"id":"484031","messageId":"ZT0oVKPzVi5TsrdS@ugly","threadId":"60435","inReplyTo":"20231028022048.GA1784118@shaak","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Oswald Buddenhagen","fromEmail":"oswald.buddenhagen@gmx.de","sentAt":"2023-10-28T15:27:16Z","receivedAt":"2023-10-28T15:27:19Z","isPatch":true,"sender":{"key":"oswald.buddenhagen@gmx.de","avatar":"https://avatars.githubusercontent.com/u/812380?v=4"},"body":"On Fri, Oct 27, 2023 at 10:20:48PM -0400, Liam Beguin wrote:\n>I agree, %aa isn't the best, I'm definitly opened to suggestions.\n>My preference would've been for something like %ad, but that's already\n>taken.\n>\nH for host would be available. (not to be confused with h for human.)\n\nin retrospect i'd say that it was unwise to use separate letters for the \nvarious forms of dates - a set of qualifiers that would be applied to a \nsingle specifier would be nicer. ah well ...\n\nregards\n"},{"id":"484037","messageId":"26e8ad28-a534-4a7b-8653-2bf580d316b5@gmail.com","threadId":"60435","inReplyTo":"ZT0oVKPzVi5TsrdS@ugly","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Andy Koppe","fromEmail":"andy.koppe@gmail.com","sentAt":"2023-10-28T21:11:19Z","receivedAt":"2023-10-28T21:11:29Z","isPatch":true,"sender":{"key":"andy.koppe@gmail.com","avatar":"https://avatars.githubusercontent.com/u/223411?v=4"},"body":"On 28/10/2023 16:27, Oswald Buddenhagen wrote:\n> On Fri, Oct 27, 2023 at 10:20:48PM -0400, Liam Beguin wrote:\n>> I agree, %aa isn't the best, I'm definitly opened to suggestions.\n>> My preference would've been for something like %ad, but that's already\n>> taken.\n>>\n> H for host would be available. (not to be confused with h for human.)\n\nBoth lowercase and uppercase would be needed though, to mirror %ae/%aE \nand %al/%aL for choosing whether to respect .mailmap. That actually \nrules out the %a@ idea as well.\n\nAndy\n"},{"id":"484059","messageId":"xmqqv8apgf4y.fsf@gitster.g","threadId":"60435","inReplyTo":"20231028021301.GA35796@coredump.intra.peff.net","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-10-29T23:53:01Z","receivedAt":"2023-10-29T23:53:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Sat, Oct 28, 2023 at 09:12:06AM +0900, Junio C Hamano wrote:\n>\n>> Grouping @gmail.com addresses do not smell all that useful, though.\n>> ... \n> One way you could directly use this is in shortlog, which these days\n> lets you group by specific formats. So:\n>\n>   git shortlog -ns --group=format:%aA\n>\n> is potentially useful.\n\nExactly.  That is what I meant by \"Grouping\", and I agree with you\nabout \"potentially\" part, too ;-)  Throwing all @gmail.com addresses\ninto a single bin would not be very useful.\n\n> ... If we could spell it as\n> %(authoremail:domain) that would remove the question. But given the\n> existence of \"%al\", I'm not too sad to see another letter allocated to\n> this purpose in the meantime.\n\nAnother line of thought is perhaps it is potentially useful to teach\nthe --format= machinery to be a bit more programmable, e.g. allowing\nto compute a substring of an existing field %{%aE#*@} without having\nto waste a letter each for the local part and domain part.  But as I\nalready said, we are now talking about \"postprocessing\", and adding\ncomplexity to our codebase only to have incomplete flexibility may\nnot be worth it.  A more specific %(authoremail:localpart) and its\ndomain counterpart may be easier to explain and understand.\n\nIn any case, it is a bit too late to say \"let's not waste the\nprecious single letter namespace to add useless features\", as we\nhave come way too far, so I do not mind too much using a currently\nunused letter $X for yet another author and committer trait.\n\n"},{"id":"484082","messageId":"20231030091011.GB84866@coredump.intra.peff.net","threadId":"60435","inReplyTo":"9a1e3e90-3e94-41fa-897d-5c64c4a42871@gmail.com","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-10-30T09:10:11Z","receivedAt":"2023-10-30T09:10:14Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Oct 28, 2023 at 07:58:31AM +0100, Andy Koppe wrote:\n\n> > I chose the \"a\" for \"address\", but I'm not sold on %aa either.\n> > I just couldn't find anything better that wasn't already taken.\n> > \n> > What about \"a@\"?\n> \n> Makes sense, and I suppose there's \"%G?\" as precedent for using a symbol\n> rather than letter in these.\n\nThis is pretty subjective, but I somehow find \"%a@\" hard to parse\nvisually (despite the fact that yes, \"%G?\" already crossed that bridge).\nBut I think the real nail in the coffin is your later comment that we\ncannot use capitalization to make the raw/mailmap distinction.\n\n> If that's not suitable though, how about \"m\" for \"mail domain\"? It also\n> immediately follows \"l\" for \"local-part\" in the alphabet.\n\nFWIW, that makes sense to me over \"a\" (though admittedly it is not\nreally any less vague than \"a\", so it really might vary from person to\nperson).\n\n-Peff\n"},{"id":"484309","messageId":"20231101190620.GA3139350@shaak","threadId":"60435","inReplyTo":"20231030091011.GB84866@coredump.intra.peff.net","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Liam Beguin","fromEmail":"liambeguin@gmail.com","sentAt":"2023-11-01T19:06:20Z","receivedAt":"2023-11-01T19:06:24Z","isPatch":true,"sender":{"key":"liambeguin@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3811160?v=4"},"body":"On Mon, Oct 30, 2023 at 05:10:11AM -0400, Jeff King wrote:\n> On Sat, Oct 28, 2023 at 07:58:31AM +0100, Andy Koppe wrote:\n> \n> > > I chose the \"a\" for \"address\", but I'm not sold on %aa either.\n> > > I just couldn't find anything better that wasn't already taken.\n> > > \n> > > What about \"a@\"?\n> > \n> > Makes sense, and I suppose there's \"%G?\" as precedent for using a symbol\n> > rather than letter in these.\n> \n> This is pretty subjective, but I somehow find \"%a@\" hard to parse\n> visually (despite the fact that yes, \"%G?\" already crossed that bridge).\n> But I think the real nail in the coffin is your later comment that we\n> cannot use capitalization to make the raw/mailmap distinction.\n> \n> > If that's not suitable though, how about \"m\" for \"mail domain\"? It also\n> > immediately follows \"l\" for \"local-part\" in the alphabet.\n> \n> FWIW, that makes sense to me over \"a\" (though admittedly it is not\n> really any less vague than \"a\", so it really might vary from person to\n> person).\n\nOkay, I like 'm' better as well. And '@' is a no go because the\nmailmaped version. I'll resend.\n\nCheers,\nLiam\n"},{"id":"484385","messageId":"4e3a5661-cba0-4849-8340-06d8d4094f48@gmail.com","threadId":"60435","inReplyTo":"20231027184357.21049-1-five231003@gmail.com","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Andy Koppe","fromEmail":"andy.koppe@gmail.com","sentAt":"2023-11-03T08:22:05Z","receivedAt":"2023-11-03T08:22:10Z","isPatch":true,"sender":{"key":"andy.koppe@gmail.com","avatar":"https://avatars.githubusercontent.com/u/223411?v=4"},"body":"\n\nOn 27/10/2023 19:40, Kousik Sanagavarapu wrote:\n> Liam Beguin <liambeguin@gmail.com> wrote:\n>> @@ -808,6 +808,17 @@ static size_t format_person_part(struct strbuf *sb, char part,\n>>   \t\tstrbuf_add(sb, mail, maillen);\n>>   \t\treturn placeholder_len;\n>>   \t}\n>> +\tif (part == 'a' || part == 'A') {\t/* domain-part */\n>> +\t\tconst char *at = memchr(mail, '@', maillen);\n>> +\t\tif (at) {\n>> +\t\t\tat += 1;\n>> +\t\t\tmaillen -= at - mail;\n>> +\t\t\tstrbuf_add(sb, at, maillen);\n>> +\t\t} else {\n>> +\t\t\tstrbuf_add(sb, mail, maillen);\n>> +\t\t}\n>> +\t\treturn placeholder_len;\n>> +\t}\n>>   \n>>   \tif (!s.date_begin)\n>>   \t\tgoto skip;\n> \n> So, if we have a domain-name, we grab it, else (the case where we don't\n> have '@') we grab it as-is. Looks good.\n\nI'm not sure that this is the right way to handle a missing '@' here \nactually, because %al already returns the whole email field in that \ncase, which makes sense as the likes of the 'mail' command would \ninterpret it as a local username.\n\nAnd if someone was going to use %al and the new specifier together to \nformat the parts of the email field differently, they probably wouldn't \nwant the field to appear twice.\n\nTherefore I think it would be more appropriate to expand to nothing in \nthat case. Tools that consume this output would already need to be able \nto deal with the empty case, as it could also happen if there's a single \n'@' at the end of the email field, or if the field is empty.\n\nRegards,\nAndy\n"},{"id":"484406","messageId":"ZUUrzIRe7j_Mu_J6@five231003","threadId":"60435","inReplyTo":"4e3a5661-cba0-4849-8340-06d8d4094f48@gmail.com","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Kousik Sanagavarapu","fromEmail":"five231003@gmail.com","sentAt":"2023-11-03T17:20:12Z","receivedAt":"2023-11-03T17:20:18Z","isPatch":true,"sender":{"key":"five231003@gmail.com","avatar":"https://avatars.githubusercontent.com/u/75560439?v=4"},"body":"On Fri, Nov 03, 2023 at 08:22:05AM +0000, Andy Koppe wrote:\n> \n> On 27/10/2023 19:40, Kousik Sanagavarapu wrote:\n> > So, if we have a domain-name, we grab it, else (the case where we don't\n> > have '@') we grab it as-is. Looks good.\n> \n> I'm not sure that this is the right way to handle a missing '@' here\n> actually, because %al already returns the whole email field in that case,\n> which makes sense as the likes of the 'mail' command would interpret it as a\n> local username.\n>\n> And if someone was going to use %al and the new specifier together to format\n> the parts of the email field differently, they probably wouldn't want the\n> field to appear twice.\n> \n> Therefore I think it would be more appropriate to expand to nothing in that\n> case. Tools that consume this output would already need to be able to deal\n> with the empty case, as it could also happen if there's a single '@' at the\n> end of the email field, or if the field is empty.\n\nI originally thought since localpart and the new domainpart are like\ncounterparts (or are symmetrical, like Peff mentioned), falling back\nlike in the case of localpart was the correct way here (again, symmetry).\n\nHaving read your reasoning though I think it makes sense to not fall back the\nsame way as localpart (%al) and return empty instead.\n\nThis goes in favor of what Liam said in the original commit message of this\nfeature being used to keep track of commits from different organizations (as\nin from GitHub or GitLab) or at least domains that make sense. As, if we\nreturn the whole email (where the email is with no domain-part or '@' is at\nthe end of the email), the whole purpose of our new feature is lost.\n\nThanks\n"},{"id":"484423","messageId":"xmqqy1fegu5i.fsf@gitster.g","threadId":"60435","inReplyTo":"4e3a5661-cba0-4849-8340-06d8d4094f48@gmail.com","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-11-04T01:54:33Z","receivedAt":"2023-11-04T01:54:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andy Koppe <andy.koppe@gmail.com> writes:\n\n> I'm not sure that this is the right way to handle a missing '@' here\n> actually, because %al already returns the whole email field in that\n> case, which makes sense as the likes of the 'mail' command would\n> interpret it as a local username.\n\nWe could expand \"%am\" to \\C-h (\\010) so that \"%al@%am\" would end up\ndisplaying the same as \"%al\" but that would be way too cute for its\nown worth ;-)\n\nIt is unfortunate that \"%al@%am\" cannot be the same as \"%ae\" for\nlocal-only address, but giving an empty string for \"%am\" if \"%ae\" is\nlocal-only would be the best we could do for our users, and certainly\nmuch better than giving the same as \"%ae\", as you said above.\n\nThanks.\n\n"},{"id":"484432","messageId":"9662afd1-a596-4d36-8c50-6c2e953a36cb@gmail.com","threadId":"60435","inReplyTo":"xmqqy1fegu5i.fsf@gitster.g","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Andy Koppe","fromEmail":"andy.koppe@gmail.com","sentAt":"2023-11-04T09:51:56Z","receivedAt":"2023-11-04T09:52:01Z","isPatch":true,"sender":{"key":"andy.koppe@gmail.com","avatar":"https://avatars.githubusercontent.com/u/223411?v=4"},"body":"\n\nOn 04/11/2023 01:54, Junio C Hamano wrote:\n> Andy Koppe <andy.koppe@gmail.com> writes:\n> \n>> I'm not sure that this is the right way to handle a missing '@' here\n>> actually, because %al already returns the whole email field in that\n>> case, which makes sense as the likes of the 'mail' command would\n>> interpret it as a local username.\n> \n> We could expand \"%am\" to \\C-h (\\010) so that \"%al@%am\" would end up\n> displaying the same as \"%al\" but that would be way too cute for its\n> own worth ;-)\n\n:)\n\nUnfortunately it also wouldn't always work, because ^H only moves the \ncursor, so if the next thing is a newline, the '@' wouldn't actually get \ndeleted.\n\n> It is unfortunate that \"%al@%am\" cannot be the same as \"%ae\" for\n> local-only address, but giving an empty string for \"%am\" if \"%ae\" is\n> local-only would be the best we could do for our users, and certainly\n> much better than giving the same as \"%ae\", as you said above.\n\nI suppose \"%@am\" could mean prepending an '@' when a domain is present, \nsimilar to how \"% am\" would mean prepending a space and \"%+am\" would \nmean prepending a newline. With that, \"%al%@am\" would be equivalent to \n\"%ae\".\n\nBut that then raises the question whether it should be implemented just \nfor \"%@[ac][mM]\", or for all placeholders. In any case, I don't think it \nneeds to be part of the changes at hand.\n\nAndy\n"},{"id":"485022","messageId":"xmqqwmucjhuw.fsf@gitster.g","threadId":"60435","inReplyTo":"xmqqv8apgf4y.fsf@gitster.g","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-11-20T20:21:43Z","receivedAt":"2023-11-20T20:21:49Z","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> Another line of thought is perhaps it is potentially useful to teach\n> the --format= machinery to be a bit more programmable, e.g. allowing\n> to compute a substring of an existing field %{%aE#*@} without having\n> to waste a letter each for the local part and domain part.  But as I\n> already said, we are now talking about \"postprocessing\", and adding\n> complexity to our codebase only to have incomplete flexibility may\n> not be worth it.  A more specific %(authoremail:localpart) and its\n> domain counterpart may be easier to explain and understand.\n>\n> In any case, it is a bit too late to say \"let's not waste the\n> precious single letter namespace to add useless features\", as we\n> have come way too far, so I do not mind too much using a currently\n> unused letter $X for yet another author and committer trait.\n\nWhen I wrote the above, I somehow forgot the existing work in the\nref-filter (aka \"for-each-ref\") placeholders, where we have support\nto a lot more flexible way to customize these things.\n\nFor example, \"%(authoremail:mailmap,localpart)\" can be used to say,\ninstead of wasting two letters 'l' and 'L' out of precious 52, that\nwe want e-mail address honoring the mailmap, and take only the local\npart.  And the support for the host part of the address that this\ntopic discussed should be implementable fairly easily (just adding\nEO_HOSTPART bit to the email_option structure would be sufficient)\non the ref-filter side.\n\nWe saw efforts from time to time to give \"log --pretty=format:\" more\nof the good things from the \"for-each-ref --format=\" placeholders\n(and vice versa), and it may give us a good way forward.\n\n"},{"id":"485510","messageId":"20231210210720.GB3139350@shaak","threadId":"60435","inReplyTo":"xmqqwmucjhuw.fsf@gitster.g","subject":"Re: [PATCH 2/2] pretty: add '%aA' to show domain-part of email addresses","fromName":"Liam Beguin","fromEmail":"liambeguin@gmail.com","sentAt":"2023-12-10T21:07:20Z","receivedAt":"2023-12-10T21:07:24Z","isPatch":true,"sender":{"key":"liambeguin@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3811160?v=4"},"body":"Hi Junio,\n\nApologies for the late reply.\n\nOn Tue, Nov 21, 2023 at 05:21:43AM +0900, Junio C Hamano wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n> > Another line of thought is perhaps it is potentially useful to teach\n> > the --format= machinery to be a bit more programmable, e.g. allowing\n> > to compute a substring of an existing field %{%aE#*@} without having\n> > to waste a letter each for the local part and domain part.  But as I\n> > already said, we are now talking about \"postprocessing\", and adding\n> > complexity to our codebase only to have incomplete flexibility may\n> > not be worth it.  A more specific %(authoremail:localpart) and its\n> > domain counterpart may be easier to explain and understand.\n> >\n> > In any case, it is a bit too late to say \"let's not waste the\n> > precious single letter namespace to add useless features\", as we\n> > have come way too far, so I do not mind too much using a currently\n> > unused letter $X for yet another author and committer trait.\n> \n> When I wrote the above, I somehow forgot the existing work in the\n> ref-filter (aka \"for-each-ref\") placeholders, where we have support\n> to a lot more flexible way to customize these things.\n\nI looked into this a little, after your first email. I'll try to make\ntime to have another look.\n\n> For example, \"%(authoremail:mailmap,localpart)\" can be used to say,\n> instead of wasting two letters 'l' and 'L' out of precious 52, that\n> we want e-mail address honoring the mailmap, and take only the local\n> part.  And the support for the host part of the address that this\n> topic discussed should be implementable fairly easily (just adding\n> EO_HOSTPART bit to the email_option structure would be sufficient)\n> on the ref-filter side.\n> \n> We saw efforts from time to time to give \"log --pretty=format:\" more\n> of the good things from the \"for-each-ref --format=\" placeholders\n> (and vice versa), and it may give us a good way forward.\n\nThis definitely sounds like a better approach than wasting two more\nletters.\n\nLiam\n"}]}