git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] git-send-email: fix get_maintainer.pl regression
@ 2017-11-16 15:48 Alex Bennée
  2017-11-16 16:46 ` Alex Bennée
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Alex Bennée @ 2017-11-16 15:48 UTC (permalink / raw)
  To: git; +Cc: Alex Bennée

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 <alex.bennee@linaro.org>
---
 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' <jdoe@example.com>],
 	q[Jane@:;\.,()<>Doe <jdoe@example.com>],
 	q[Jane <jdoe@example.com> Doe],
-	q[<jdoe@example.com> Jane Doe]);
+	q[<jdoe@example.com> Jane Doe],
+	q[jdoe@example.com (open list:for thing (foo/bar))],
+    );
 
 my @known_failure_list = (q[Jane\ Doe <jdoe@example.com>],
 	q["Doe, Ja"ne <jdoe@example.com>],
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 <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
+"
+
+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


^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2017-12-12 22:19 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-16 15:48 [PATCH] git-send-email: fix get_maintainer.pl regression Alex Bennée
2017-11-16 16:46 ` Alex Bennée
2017-11-19  2:54 ` Eric Sunshine
2017-11-20 10:44   ` Alex Bennée
2017-11-20 22:34     ` Eric Sunshine
2017-11-20 18:57   ` Eric Sunshine
2017-11-21  0:07     ` Philip Oakley
2017-11-21  0:30       ` Eric Sunshine
2017-11-21  0:32     ` Junio C Hamano
2017-11-20 22:14 ` Eric Sunshine
2017-11-21 20:46   ` Alex Bennée
2017-11-21 20:52     ` Thomas Adam
2017-11-22  1:34       ` Junio C Hamano
2017-12-11 17:13         ` Alex Bennée
2017-12-11 17:26           ` Thomas Adam
2017-12-11 19:46             ` Ævar Arnfjörð Bjarmason
2017-12-12 10:30               ` Thomas Adam
2017-12-12 11:49                 ` Ævar Arnfjörð Bjarmason
2017-12-12 16:40                 ` Alex Bennée
2017-12-12 18:14                   ` Ævar Arnfjörð Bjarmason
2017-12-12 19:35                     ` Junio C Hamano
2017-12-12 21:25                       ` Ævar Arnfjörð Bjarmason
2017-12-12 22:19                         ` Junio C Hamano
     [not found]       ` <b131cc195280498ea3a77a37eff8444e@BPMBX2013-01.univ-lyon1.fr>
2017-11-22  8:22         ` Matthieu Moy
2017-11-22  9:05           ` Alex Bennée
2017-11-22  9:49             ` Thomas Adam
2017-11-22 10:44           ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).