mailinfo: don't discard names under 3 characters
PATCH 1/1 mailinfo: don't discard names under 3 characters
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.
---
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(-)
mailinfo.c +1 -1
@@ -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)
Signature · 1 line
2.24.1
Seems I forgot something:
Quoted 10 lines · 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.
---
I'm not *completely* sure there's even a case wheresrc = emailis 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
PATCH v2 1/1 mailinfo: don't discard names under 3 characters
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.
---
Rebased and with Signed-off-by this time :)
mailinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mailinfo.c +1 -1
@@ -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 ;
Signature · 1 line
2.30.0
Quoted 18 lines · 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.
Signed-off-by edef <[email protected]>---
Rebased and with Signed-off-by this time :)mailinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mailinfo.c +0
-0
mailinfo.c static void cleanup_space(struct strbuf *sb) · line 25
Quoted 8 lines
mailinfo.c +1
-1@@ -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.