From: Alex Bennée Date: Thu, 16 Nov 2017 15:48:14 GMT Subject: [PATCH] git-send-email: fix get_maintainer.pl regression Message-ID: <20171116154814.23785-1-alex.bennee@linaro.org> Getting rid of Mail::Address regressed behaviour with common get_maintainer scripts such as the Linux kernel. Fix the missed corner case and add a test for it. Fixes: cc9075067776ebd34cc08f31bf78bb05f12fd879 Signed-off-by: Alex Bennée --- perl/Git.pm | 3 +++ t/t9000/test.pl | 4 +++- t/t9001-send-email.sh | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/perl/Git.pm b/perl/Git.pm index ffa09ace9..9b17de1cc 100644 --- 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"; } elsif ($token eq "<") { push @phrase, (splice @address), (splice @buffer); } elsif ($token eq ">") { diff --git a/t/t9000/test.pl b/t/t9000/test.pl index dfeaa9c65..f10be50cd 100755 --- a/t/t9000/test.pl +++ b/t/t9000/test.pl @@ -35,7 +35,9 @@ my @success_list = (q[Jane], q['Jane 'Doe' ], q[Jane@:;\.,()<>Doe ], q[Jane Doe], - q[ Jane Doe]); + q[ Jane Doe], + q[jdoe@example.com (open list:for thing (foo/bar))], + ); my @known_failure_list = (q[Jane\ Doe ], q["Doe, Ja"ne ], diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 4d261c2a9..0bcd7ab96 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -172,6 +172,27 @@ test_expect_success $PREREQ 'cc trailer with various syntax' ' test_cmp expected-cc commandline1 ' +test_expect_success $PREREQ 'setup get_mainter script for cc trailer' " +cat >expected-cc-script.sh <<-EOF && chmod +x expected-cc-script.sh +#!/bin/sh +echo 'One Person (supporter:THIS (FOO/bar))' +echo 'Two Person (maintainer:THIS THING)' +echo 'Third List (moderated list:THIS THING (FOO/bar))' +echo ' (moderated list:FOR THING)' +echo 'five@example.com (open list:FOR THING (FOO/bar))' +echo 'six@example.com (open list)' +EOF +" + +test_expect_success $PREREQ 'cc trailer with get_maintainer output' ' + test_commit cc-trailer && + clean_fake_sendmail && + git send-email -1 --to=recipient@example.com \ + --cc-cmd="$(pwd)/expected-cc-script.sh" \ + --smtp-server="$(pwd)/fake.sendmail" && + test_cmp expected-cc commandline1 +' + test_expect_success $PREREQ 'setup expect' " cat >expected-show-all-headers <<\EOF 0001-Second.patch -- 2.15.0