git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] ident: don't consider trailing dot crud

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 31, 2023, 21:49 UTC
Message-ID
<xmqqpm4721lm.fsf@gitster.g>
In-Reply-To
<20230731214435.1462098-1-sandals@crustytoothpaste.net>
"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.
Show 66 quoted lines
> 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' '
Previous: brian m. carlsonNext: Junio C Hamano
Message 10 of 15 in “Git is removing . from the last part of user.name”
  1. Daniel P.Aug 22, 2021
  2. brian m. carlsonAug 22, 2021
  3. Jeff KingAug 22, 2021
  4. Jeff KingAug 22, 2021
  5. Junio C HamanoAug 23, 2021
  6. Thomas J. Faughnan Jr.Jul 30, 2023
  7. Junio C HamanoJul 31, 2023
  8. brian m. carlsonJul 31, 2023
  9. ident: don't consider trailing dot crudbrian m. carlson, Jul 31, 2023
  10. Junio C HamanoJul 31, 2023
  11. Junio C HamanoAug 2, 2023
  12. brian m. carlsonAug 2, 2023
  13. Junio C HamanoAug 2, 2023
  14. Thomas J. Faughnan Jr.Jul 31, 2023
  15. Junio C HamanoJul 31, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.