git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: <git@vger.kernel.org>, Jeff King <peff@peff.net>,
	"Thomas J. Faughnan Jr." <thomas@faughnan.net>,
	"Daniel P." <danpltile@gmail.com>
Subject: Re: [PATCH] ident: don't consider trailing dot crud
Date: Mon, 31 Jul 2023 14:49:25 -0700	[thread overview]
Message-ID: <xmqqpm4721lm.fsf@gitster.g> (raw)
In-Reply-To: <20230731214435.1462098-1-sandals@crustytoothpaste.net> (brian m. carlson's message of "Mon, 31 Jul 2023 21:44:35 +0000")

"brian m. carlson" <sandals@crustytoothpaste.net> writes:

> When we process a user's name (as in user.name), we strip all trailing
> crud from it.  Right now, we consider a dot trailing crud, and strip it
> off.

We consider a leading or trailing dot crud, I think (applies also to
the title of the patch).  Otherwise the change, together with the
test updates, all look good.

I wonder if this needs some credit to those involved in the original
thread?

Thanks.

> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---
>  ident.c                       |  1 -
>  t/t4203-mailmap.sh            |  4 ++--
>  t/t7518-ident-corner-cases.sh | 11 ++++++++++-
>  3 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/ident.c b/ident.c
> index 08be4d0747..cc7afdbf81 100644
> --- a/ident.c
> +++ b/ident.c
> @@ -203,7 +203,6 @@ void reset_ident_date(void)
>  static int crud(unsigned char c)
>  {
>  	return  c <= 32  ||
> -		c == '.' ||
>  		c == ',' ||
>  		c == ':' ||
>  		c == ';' ||
> diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
> index fa7f987284..2016132f51 100755
> --- a/t/t4203-mailmap.sh
> +++ b/t/t4203-mailmap.sh
> @@ -466,7 +466,7 @@ test_expect_success 'gitmailmap(5) example output: example #1' '
>  	Author Jane Doe <jane@laptop.(none)> maps to Jane Doe <jane@laptop.(none)>
>  	Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
>  
> -	Author Jane D <jane@desktop.(none)> maps to Jane Doe <jane@desktop.(none)>
> +	Author Jane D. <jane@desktop.(none)> maps to Jane Doe <jane@desktop.(none)>
>  	Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
>  	EOF
>  	git -C doc log --reverse --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual &&
> @@ -494,7 +494,7 @@ test_expect_success 'gitmailmap(5) example output: example #2' '
>  	Author Jane Doe <jane@laptop.(none)> maps to Jane Doe <jane@example.com>
>  	Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
>  
> -	Author Jane D <jane@desktop.(none)> maps to Jane Doe <jane@example.com>
> +	Author Jane D. <jane@desktop.(none)> maps to Jane Doe <jane@example.com>
>  	Committer C O Mitter <committer@example.com> maps to C O Mitter <committer@example.com>
>  	EOF
>  	git -C doc log --reverse --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual &&
> diff --git a/t/t7518-ident-corner-cases.sh b/t/t7518-ident-corner-cases.sh
> index fffdb6ff2e..9ab2ae2f3b 100755
> --- a/t/t7518-ident-corner-cases.sh
> +++ b/t/t7518-ident-corner-cases.sh
> @@ -20,10 +20,19 @@ test_expect_success 'empty name and missing email' '
>  '
>  
>  test_expect_success 'commit rejects all-crud name' '
> -	test_must_fail env GIT_AUTHOR_NAME=" .;<>" \
> +	test_must_fail env GIT_AUTHOR_NAME=" ,;<>" \
>  		git commit --allow-empty -m foo
>  '
>  
> +test_expect_success 'commit does not strip trailing dot' '
> +	author_name="Pat Doe Jr." &&
> +	env GIT_AUTHOR_NAME="$author_name" \
> +		git commit --allow-empty -m foo &&
> +	git log -1 --format=%an >actual &&
> +	echo "$author_name" >expected &&
> +	test_cmp actual expected
> +'
> +
>  # We must test the actual error message here, as an unwanted
>  # auto-detection could fail for other reasons.
>  test_expect_success 'empty configured name does not auto-detect' '

  reply	other threads:[~2023-07-31 21:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-22 14:19 Git is removing . from the last part of user.name Daniel P.
2021-08-22 15:33 ` brian m. carlson
2021-08-22 19:28   ` Jeff King
2021-08-22 19:35     ` Jeff King
2021-08-23 16:25     ` Junio C Hamano
2023-07-30 21:38     ` Thomas J. Faughnan Jr.
2023-07-31 15:56       ` Junio C Hamano
2023-07-31 21:02         ` brian m. carlson
2023-07-31 21:44           ` [PATCH] ident: don't consider trailing dot crud brian m. carlson
2023-07-31 21:49             ` Junio C Hamano [this message]
2023-08-02 16:49               ` Junio C Hamano
2023-08-02 21:27                 ` brian m. carlson
2023-08-02 21:38                   ` Junio C Hamano
2023-07-31 21:56             ` Thomas J. Faughnan Jr.
2023-07-31 22:05               ` Junio C Hamano

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=xmqqpm4721lm.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=danpltile@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    --cc=thomas@faughnan.net \
    /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;
as well as URLs for NNTP newsgroup(s).