Re: [PATCH] git-send-email: fix --cc-cmd get_maintainer.pl regression
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Nov 20, 2017, 23:04 UTC
- Message-ID
- <CAPig+cTkPUVgEaDK+yo9+JdE1Mmx0kEOV5EfCQYeswd8vkxJNw@mail.gmail.com>
- In-Reply-To
- <20171120114101.16508-1-alex.bennee@linaro.org>
On Mon, Nov 20, 2017 at 6:41 AM, Alex Bennée <alex.bennee@linaro.org> wrote:
Show 16 quoted lines
> 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@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_cg2kUFUtA5uVkZDrRRSi2x7vg@mail.gmail.com/
Show 11 quoted lines
> 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@example.com> (supporter:THIS (FOO/bar))" > +echo "Two Person <two@example.com> (maintainer:THIS THING)" > +echo "Third List <three@example.com> (moderated list:THIS THING (FOO/bar))" > +echo "<four@example.com> (moderated list:FOR THING)" > +echo "five@example.com (open list:FOR THING (FOO/bar))" > +echo "six@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.
Show 6 quoted lines
> + clean_fake_sendmail && > + git send-email -1 --to=recipient@example.com \ > + --cc-cmd=./expected-cc-script.sh \ > + --smtp-server="$(pwd)/fake.sendmail" && > + test_cmp expected-cc commandline1 > +'