From: Prarit Bhargava <prarit@redhat.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] pretty: Add "%aU"|"%au" option to output author's username
Date: Wed, 23 Oct 2019 11:03:50 -0400 [thread overview]
Message-ID: <987b7743-df0c-dbcf-6336-23f2903c061a@redhat.com> (raw)
In-Reply-To: <xmqqy2xcjqc8.fsf@gitster-ct.c.googlers.com>
On 10/22/19 7:46 PM, Junio C Hamano wrote:
> Prarit Bhargava <prarit@redhat.com> writes:
>
>> Subject: Re: [PATCH] pretty: Add "%aU"|"%au" option to output author's username
>
> Downcase "Add" (see "git shortlog --no-merges -100 master" and
> mimick the project convention).
I'll fix that.
>
>> Add a "%aU"|"%au" option that outputs the author's email username.
>
> Even though I personally do not see the use for it, I agree it would
> make sense to have an option to show the local part only where the
> e-mail address is shown.
>
> I do not know if u/U is a good mnemonic; it hints too strongly that
> it may come from GIT_{AUTHOR/COMMITTER}_NAME but that is not what
> you are doing---isn't there a letter that better conveys that this
> is about RFC 2822 local-part (cf. page 16 ieft.org/rfc/rfc2822.txt)?
I'll go with "l" and "L" for local-part as defined on page 16. I will also
include a comment in braces that says (the portion of the email address
preceding the '@' symbol)". Admittedly that doesn't convey the meaning of the
mailbox concept of the email address it does tell a user what is going to be output.
>
>> diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt
>> index b87e2e83e6d0..479a15a8ab12 100644
>> --- a/Documentation/pretty-formats.txt
>> +++ b/Documentation/pretty-formats.txt
>> @@ -163,6 +163,9 @@ The placeholders are:
>> '%ae':: author email
>> '%aE':: author email (respecting .mailmap, see linkgit:git-shortlog[1]
>> or linkgit:git-blame[1])
>> +'%au':: author username
>> +'%aU':: author username (respecting .mailmap, see linkgit:git-shortlog[1]
>> + or linkgit:git-blame[1])
>> '%ad':: author date (format respects --date= option)
>> '%aD':: author date, RFC2822 style
>> '%ar':: author date, relative
>
>> diff --git a/pretty.c b/pretty.c
>> index b32f0369531c..2a5b93022050 100644
>> --- a/pretty.c
>> +++ b/pretty.c
>> @@ -706,6 +706,11 @@ static size_t format_person_part(struct strbuf *sb, char part,
>> strbuf_add(sb, mail, maillen);
>> return placeholder_len;
>> }
>> + if (part == 'u' || part == 'U') { /* username */
>> + maillen = strstr(s.mail_begin, "@") - s.mail_begin;
>> + strbuf_add(sb, mail, maillen);
>> + return placeholder_len;
>> + }
>
> I think users get %eu and %eU for free with this change, which should
> be documented.
>
Did you mean %cu and %cU? Or am I missing something with "%e"?
P.
next prev parent reply other threads:[~2019-10-23 15:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 23:28 [PATCH] pretty: Add "%aU"|"%au" option to output author's username Prarit Bhargava
2019-10-22 23:46 ` Junio C Hamano
2019-10-23 15:03 ` Prarit Bhargava [this message]
2019-10-22 23:48 ` brian m. carlson
2019-10-23 15:08 ` Prarit Bhargava
2019-10-24 2:29 ` Junio C Hamano
2019-10-24 12:43 ` Prarit Bhargava
2019-10-23 5:02 ` Jeff King
2019-10-23 15:58 ` Prarit Bhargava
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=987b7743-df0c-dbcf-6336-23f2903c061a@redhat.com \
--to=prarit@redhat.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox