Re: [PATCH] git-send-email: fix --cc-cmd get_maintainer.pl regression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 20, 2017 at 6:41 AM, Alex Bennée <alex.bennee@xxxxxxxxxx> 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.bennee@xxxxxxxxxx>
> ---
> 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_cg2kUFUtA5uVkZDrRRSi2x7vg@xxxxxxxxxxxxxx/

> 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 <one@xxxxxxxxxxx> (supporter:THIS (FOO/bar))"
> +echo "Two Person <two@xxxxxxxxxxx> (maintainer:THIS THING)"
> +echo "Third List <three@xxxxxxxxxxx> (moderated list:THIS THING (FOO/bar))"
> +echo "<four@xxxxxxxxxxx> (moderated list:FOR THING)"
> +echo "five@xxxxxxxxxxx (open list:FOR THING (FOO/bar))"
> +echo "six@xxxxxxxxxxx (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=recipient@xxxxxxxxxxx \
> +               --cc-cmd=./expected-cc-script.sh \
> +               --smtp-server="$(pwd)/fake.sendmail" &&
> +       test_cmp expected-cc commandline1
> +'




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux