Git is removing . from the last part of user.name

5 messages, 4 authors, 2023-07-30 · open the first message on its own page

Git is removing . from the last part of user.name

From: Daniel P. <hidden>
Date: 2021-08-22 14:19:49

If user.name's  value has a . as the last character of the last part
of the name, git is removing it from commit operations. But git-config
shows the .

example:

in .gitconfig:

[user]
    name = Daniel P.


`git config user.name`:

user.name=Daniel P.


from `git show`:

Author: Daniel P [off-list ref]

Re: Git is removing . from the last part of user.name

From: brian m. carlson <hidden>
Date: 2021-08-22 15:34:09

On 2021-08-22 at 14:19:33, Daniel P. wrote:
If user.name's  value has a . as the last character of the last part
of the name, git is removing it from commit operations. But git-config
shows the .

example:

in .gitconfig:

[user]
    name = Daniel P.


`git config user.name`:

user.name=Daniel P.


from `git show`:

Author: Daniel P [off-list ref]
Yes, it does appear we do that.  We consider a period to be "crud" and
strip off trailing crud.  I think we should probably change that, since
in some places people write their family name first, and so a name like
“carlson brian m.” might be a thing people might want to write, in
addition to this particular case.

In any event, it's not very polite to "correct" people's names for them.
I myself have certainly run into that often enough.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

Re: Git is removing . from the last part of user.name

From: Jeff King <hidden>
Date: 2021-08-22 19:28:59

On Sun, Aug 22, 2021 at 03:33:31PM +0000, brian m. carlson wrote:
On 2021-08-22 at 14:19:33, Daniel P. wrote:
quoted
If user.name's  value has a . as the last character of the last part
of the name, git is removing it from commit operations. But git-config
shows the .

example:

in .gitconfig:

[user]
    name = Daniel P.


`git config user.name`:

user.name=Daniel P.


from `git show`:

Author: Daniel P [off-list ref]
Yes, it does appear we do that.  We consider a period to be "crud" and
strip off trailing crud.  I think we should probably change that, since
in some places people write their family name first, and so a name like
“carlson brian m.” might be a thing people might want to write, in
addition to this particular case.

In any event, it's not very polite to "correct" people's names for them.
I myself have certainly run into that often enough.
A lot of this name-cleanup code came from an era where we were inferring
names from gecos fields or from hacky email parsing.

I agree that if somebody has given us a definite name via config, we
should mostly leave it intact (the exception being syntactic elements
like <>). But we may still want to keep some of the "crud" cleanup when
we are pulling from those other sources.

OTOH, this crud stuff goes all the way back to 5e5128ed1c (Remove
extraneous ',' ';' and '.' characters from the full name gecos field.,
2005-04-17). We warn in pretty big letters these days about pulling an
ident from gecos, and our rfc822 parsing is more robust than it once
was. So it may be time to just retire most of it. The unfortunate thing
is we won't know how many people complain until it's released.

On a somewhat lesser note, I'm tempted to say that "." probably was
never that useful (compared to say, comma, which is the gecos
separator), and we could probably just drop it from the crud list.

-Peff

Re: Git is removing . from the last part of user.name

From: Jeff King <hidden>
Date: 2021-08-22 19:35:22

On Sun, Aug 22, 2021 at 03:28:57PM -0400, Jeff King wrote:
On a somewhat lesser note, I'm tempted to say that "." probably was
never that useful (compared to say, comma, which is the gecos
separator), and we could probably just drop it from the crud list.
This does break a few tests, but none that I think explicitly were
arguing for keeping the dot. One was just a general crud test, and the
other was just documenting the current behavior while testing something
else (and perhaps even argues _for_ the change, as somebody bothered to
write --author='Jane D.' in the first place).

---
diff --git a/ident.c b/ident.c
index 85d9ba7120..2d136d27c8 100644
--- a/ident.c
+++ b/ident.c
@@ -198,7 +198,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 0b2d21ec55..a1cdc2905f 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 905957bd0a..738c723861 100755
--- a/t/t7518-ident-corner-cases.sh
+++ b/t/t7518-ident-corner-cases.sh
@@ -18,7 +18,7 @@ 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
 '
 

Re: Git is removing . from the last part of user.name

From: Thomas J. Faughnan Jr. <hidden>
Date: 2023-07-30 21:43:00

On a somewhat lesser note, I'm tempted to say that "." probably was
never that useful (compared to say, comma, which is the gecos
separator), and we could probably just drop it from the crud list.
Would this change still be considered? Or alternatively a git config
option to ignore "." when checking if a character is crud?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help