Re: git send-email splits name with comma

3 messages, 3 authors, 2021-10-04 · open the first message on its own page

Re: git send-email splits name with comma

From: Junio C Hamano <hidden>
Date: 2021-10-04 18:47:19

Geert Uytterhoeven [off-list ref] writes:
Hi Andreas,

On Mon, Oct 4, 2021 at 4:31 PM Andreas Schwab [off-list ref] wrote:
quoted
On Okt 04 2021, Geert Uytterhoeven wrote:
quoted
If the name of an email address contains a comma, it will be split
incorrectly into multiple addresses.
If you want to include a comma in the display-name part of an address,
you need to use the quoted-string form of the phrase.
Adding more quoting like:

    git send-email --to "\"foo bar, geert\" [off-list ref]"

indeed works.  But I feel git send-email could do better, given it already
receives the full email address in a single argv[] entry.
Sorry, but I do not quite follow.

If I were to send a message both to the list and to you, wouldn't

    git send-email --to "l-k@vger.k.org, geert <g@l-m68k.o>"

a valid way to do so?

Re: git send-email splits name with comma

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2021-10-04 19:57:13

Hi Junio,

On Mon, Oct 4, 2021 at 8:47 PM Junio C Hamano [off-list ref] wrote:
Geert Uytterhoeven [off-list ref] writes:
quoted
On Mon, Oct 4, 2021 at 4:31 PM Andreas Schwab [off-list ref] wrote:
quoted
On Okt 04 2021, Geert Uytterhoeven wrote:
quoted
If the name of an email address contains a comma, it will be split
incorrectly into multiple addresses.
If you want to include a comma in the display-name part of an address,
you need to use the quoted-string form of the phrase.
Adding more quoting like:

    git send-email --to "\"foo bar, geert\" [off-list ref]"

indeed works.  But I feel git send-email could do better, given it already
receives the full email address in a single argv[] entry.
Sorry, but I do not quite follow.

If I were to send a message both to the list and to you, wouldn't

    git send-email --to "l-k@vger.k.org, geert <g@l-m68k.o>"

a valid way to do so?
Oh wait, I never realized --to and --cc take multiple email addresses;
I also use multiple --to/--cc options instead.
So the behavior I see is actually the expected behavior.
Thanks, and sorry for the noise.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Re: git send-email splits name with comma

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-10-04 23:55:24

On Mon, Oct 04 2021, Geert Uytterhoeven wrote:
Hi Junio,

On Mon, Oct 4, 2021 at 8:47 PM Junio C Hamano [off-list ref] wrote:
quoted
Geert Uytterhoeven [off-list ref] writes:
quoted
On Mon, Oct 4, 2021 at 4:31 PM Andreas Schwab [off-list ref] wrote:
quoted
On Okt 04 2021, Geert Uytterhoeven wrote:
quoted
If the name of an email address contains a comma, it will be split
incorrectly into multiple addresses.
If you want to include a comma in the display-name part of an address,
you need to use the quoted-string form of the phrase.
Adding more quoting like:

    git send-email --to "\"foo bar, geert\" [off-list ref]"

indeed works.  But I feel git send-email could do better, given it already
receives the full email address in a single argv[] entry.
Sorry, but I do not quite follow.

If I were to send a message both to the list and to you, wouldn't

    git send-email --to "l-k@vger.k.org, geert <g@l-m68k.o>"

a valid way to do so?
Oh wait, I never realized --to and --cc take multiple email addresses;
I also use multiple --to/--cc options instead.
So the behavior I see is actually the expected behavior.
Thanks, and sorry for the noise.

Gr{oetje,eeting}s,
FWIW git-send-email just defers to Perl's Mail::Address module here:

perl -MMail::Address -MData::Dumper -wE 'warn qq[For @ARGV got: ] .
     Dumper [map { $_->format } map { Mail::Address->parse($_) } @ARGV]
' 'foo, bar [off-list ref]'
For foo, bar [off-list ref] got: $VAR1 = [
          'foo',
          'bar [off-list ref]'
        ];

As has been noted the quotes are needed, and the same should go for yor
mailer.

Anyway, that's covered already, but if anyone cared to make it
friendlier I don't see why it couldn't be made to be nicer.

I.e. we could loop over the list, use $_->address to see that the "foo"
doesn't even have an "@" in it, and either fix it up to what th user
probably meant, or do so conditionally, warn or whatever.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help