git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
> +'
Previous: Alex Bennée
Message 2 of 2 in “git-send-email: fix --cc-cmd get_maintainer.pl regression”
  1. git-send-email: fix --cc-cmd get_maintainer.pl regressionAlex Bennée, Nov 20, 2017
  2. Eric SunshineNov 20, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.