On Mon, Nov 20, 2017 at 6:41 AM, Alex Bennée <alex.ben...@linaro.org> wrote:
> Since the removal of Mail::Address from git-send-email certain address
> patterns returned by common get_maintainer.pl scripts now fail to get
> correctly parsed by the built-in Git::parse_mailboxes. Specifically
> the patterns with embedded parenthesis fail. For example from the
> Linux kernel MAINTAINERS:
> [...snip...]
> Signed-off-by: Alex Bennée <alex.ben...@linaro.org>
> ---
> diff --git a/perl/Git.pm b/perl/Git.pm
> @@ -936,6 +936,9 @@ sub parse_mailboxes {
>                         $end_of_addr_seen = 0;
>                 } elsif ($token =~ /^\(/) {
>                         push @comment, $token;
> +               } elsif ($token =~ /^\)/) {
> +                       my $nested_comment = pop @comment;
> +                       push @comment, "$nested_comment$token";

See [1] for commentary on this fix being too fragile and working only
for this very specific case.

[1]: 
https://public-inbox.org/git/CAPig+cTXq6jSN9f2_xyj=jfv_cg2kufuta5uvkzdrrrsi2x...@mail.gmail.com/

> diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
> @@ -172,6 +172,22 @@ test_expect_success $PREREQ 'cc trailer with various 
> syntax' '
> +test_expect_success $PREREQ 'cc trailer with get_maintainer output' '
> +        write_script expected-cc-script.sh <<-EOF &&
> +echo "One Person <o...@example.com> (supporter:THIS (FOO/bar))"
> +echo "Two Person <t...@example.com> (maintainer:THIS THING)"
> +echo "Third List <th...@example.com> (moderated list:THIS THING (FOO/bar))"
> +echo "<f...@example.com> (moderated list:FOR THING)"
> +echo "f...@example.com (open list:FOR THING (FOO/bar))"
> +echo "s...@example.com (open list)"
> +EOF

Since you've used -EOF, you can indent this entire block (with tabs)
to the level of the write_script() to make it easier to read.

Also, it's recommended to use -\EOF to suppress interpolation within
the here-doc; it's not needed in this case, but doing so states
intent.

> +       clean_fake_sendmail &&
> +       git send-email -1 --to=recipi...@example.com \
> +               --cc-cmd=./expected-cc-script.sh \
> +               --smtp-server="$(pwd)/fake.sendmail" &&
> +       test_cmp expected-cc commandline1
> +'

Reply via email to