git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH] mailinfo: don't discard names under 3 characters
@ 2019-12-20  0:39 edef
  2019-12-20 13:37 ` edef
  2020-01-30 10:06 ` Jeff King
  0 siblings, 2 replies; 5+ messages in thread
From: edef @ 2019-12-20  0:39 UTC (permalink / raw)
  To: git; +Cc: edef

I sometimes receive patches from people with short mononyms, and in my
cultural environment these are not uncommon. To my dismay, git-am
currently discards their names, and replaces them with their email
addresses.

Link: https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/
---
I'm not *completely* sure there's even a case where `src = email` is 
the right thing to do, but I'd rather not modify this code more than 
strictly necessary.

 mailinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mailinfo.c b/mailinfo.c
index b395adbdf2..7274232e28 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -19,7 +19,7 @@ static void cleanup_space(struct strbuf *sb)
 static void get_sane_name(struct strbuf *out, struct strbuf *name, struct strbuf *email)
 {
 	struct strbuf *src = name;
-	if (name->len < 3 || 60 < name->len || strchr(name->buf, '@') ||
+	if (!name->len || 60 < name->len || strchr(name->buf, '@') ||
 		strchr(name->buf, '<') || strchr(name->buf, '>'))
 		src = email;
 	else if (name == out)
-- 
2.24.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mailinfo: don't discard names under 3 characters
  2019-12-20  0:39 [PATCH] mailinfo: don't discard names under 3 characters edef
@ 2019-12-20 13:37 ` edef
  2020-01-30 10:06 ` Jeff King
  1 sibling, 0 replies; 5+ messages in thread
From: edef @ 2019-12-20 13:37 UTC (permalink / raw)
  To: git; +Cc: edef

Seems I forgot something:

Signed-off-by: edef <edef@edef.eu>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mailinfo: don't discard names under 3 characters
  2019-12-20  0:39 [PATCH] mailinfo: don't discard names under 3 characters edef
  2019-12-20 13:37 ` edef
@ 2020-01-30 10:06 ` Jeff King
  2021-05-16 15:07   ` [PATCH v2] " edef
  1 sibling, 1 reply; 5+ messages in thread
From: Jeff King @ 2020-01-30 10:06 UTC (permalink / raw)
  To: edef; +Cc: git

On Fri, Dec 20, 2019 at 12:39:48AM +0000, edef wrote:

> I sometimes receive patches from people with short mononyms, and in my
> cultural environment these are not uncommon. To my dismay, git-am
> currently discards their names, and replaces them with their email
> addresses.
> 
> Link: https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/
> ---
> I'm not *completely* sure there's even a case where `src = email` is 
> the right thing to do, but I'd rather not modify this code more than 
> strictly necessary.

I think this makes sense. There's a lot of heuristic voodoo in this old
mailinfo code, but I think getting people's legitimate short names wrong
is worse than the likelihood that this is actually helping some
broken-parsing case in any meaningful way. I suspect this code predates
us parsing the headers carefully according to the standard (it looks to
be from 2744b2344d on 2005-04-11, which is quite early!).

The 60-char maximum also seems like something people might run afoul of
in certain cultures. Is it worth bumping, too?

I think your patch slipped through the cracks, coming as it did over the
holidays. It's probably worth re-posting it (with your signed-off-by).

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] mailinfo: don't discard names under 3 characters
  2020-01-30 10:06 ` Jeff King
@ 2021-05-16 15:07   ` edef
  2021-05-16 22:57     ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: edef @ 2021-05-16 15:07 UTC (permalink / raw)
  To: git; +Cc: edef

I sometimes receive patches from people with short mononyms, and in my
cultural environment these are not uncommon. To my dismay, git-am
currently discards their names, and replaces them with their email
addresses.

Link: https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/
Signed-off-by: edef <edef@edef.eu>
---
Rebased and with Signed-off-by this time :)

 mailinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mailinfo.c b/mailinfo.c
index 95ce191f38..626228654c 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -19,7 +19,7 @@ static void cleanup_space(struct strbuf *sb)
 static void get_sane_name(struct strbuf *out, struct strbuf *name, struct strbuf *email)
 {
 	struct strbuf *src = name;
-	if (name->len < 3 || 60 < name->len || strpbrk(name->buf, "@<>"))
+	if (!name->len || 60 < name->len || strpbrk(name->buf, "@<>"))
 		src = email;
 	else if (name == out)
 		return;
-- 
2.30.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mailinfo: don't discard names under 3 characters
  2021-05-16 15:07   ` [PATCH v2] " edef
@ 2021-05-16 22:57     ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2021-05-16 22:57 UTC (permalink / raw)
  To: edef; +Cc: git

edef <edef@edef.eu> writes:

> I sometimes receive patches from people with short mononyms, and in my
> cultural environment these are not uncommon. To my dismay, git-am
> currently discards their names, and replaces them with their email
> addresses.
>
> Link: https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/
> Signed-off-by: edef <edef@edef.eu>
> ---
> Rebased and with Signed-off-by this time :)
>
>  mailinfo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mailinfo.c b/mailinfo.c
> index 95ce191f38..626228654c 100644
> --- a/mailinfo.c
> +++ b/mailinfo.c
> @@ -19,7 +19,7 @@ static void cleanup_space(struct strbuf *sb)
>  static void get_sane_name(struct strbuf *out, struct strbuf *name, struct strbuf *email)
>  {
>  	struct strbuf *src = name;
> -	if (name->len < 3 || 60 < name->len || strpbrk(name->buf, "@<>"))
> +	if (!name->len || 60 < name->len || strpbrk(name->buf, "@<>"))
>  		src = email;
>  	else if (name == out)
>  		return;

Wow.  The original of this was from very late in 2019, wasn't it?

Thanks for updating; will queue.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-16 22:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-20  0:39 [PATCH] mailinfo: don't discard names under 3 characters edef
2019-12-20 13:37 ` edef
2020-01-30 10:06 ` Jeff King
2021-05-16 15:07   ` [PATCH v2] " edef
2021-05-16 22:57     ` Junio C Hamano

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).