All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	Andreas Schwab <schwab@linux-m68k.org>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: git send-email splits name with comma
Date: Tue, 05 Oct 2021 01:47:36 +0200	[thread overview]
Message-ID: <87pmskl508.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <CAMuHMdVHuxzKv7z+oVnPXSBi8bLnGMZDcXdgtGR4N15UQttciQ@mail.gmail.com>


On Mon, Oct 04 2021, Geert Uytterhoeven wrote:

> Hi Junio,
>
> On Mon, Oct 4, 2021 at 8:47 PM Junio C Hamano <gitster@pobox.com> wrote:
>> Geert Uytterhoeven <geert@linux-m68k.org> writes:
>> > On Mon, Oct 4, 2021 at 4:31 PM Andreas Schwab <schwab@linux-m68k.org> wrote:
>> >> On Okt 04 2021, Geert Uytterhoeven wrote:
>> >> > 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\" <geert@linux-m68k.org>"
>> >
>> > 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 <x@example.com>'
For foo, bar <x@example.com> got: $VAR1 = [
          'foo',
          'bar <x@example.com>'
        ];

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.

      reply	other threads:[~2021-10-04 23:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04 14:11 git send-email splits name with comma Geert Uytterhoeven
2021-10-04 14:31 ` Andreas Schwab
2021-10-04 17:18   ` Geert Uytterhoeven
2021-10-04 18:47     ` Junio C Hamano
2021-10-04 19:56       ` Geert Uytterhoeven
2021-10-04 23:47         ` Ævar Arnfjörð Bjarmason [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pmskl508.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.