From e3fdbcc8e16474f50749a384175f78908c4f038e Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Thu, 13 Oct 2016 07:47:27 +0200 Subject: parse_mailboxes: accept extra text after <...> address The test introduced in this commit succeeds without the patch to Git.pm if Mail::Address is installed, but fails otherwise because our in-house parser does not accept any text after the email address. They succeed both with and without Mail::Address after this commit. Mail::Address accepts extra text and considers it as part of the name, iff the address is surrounded with <...>. The implementation mimics this behavior as closely as possible. This mostly restores the behavior we had before b1c8a11 (send-email: allow multiple emails using --cc, --to and --bcc, 2015-06-30), but we keep the possibility to handle comma-separated lists. Reported-by: Larry Finger Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- t/t9001-send-email.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 't') diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index bbfed5650d..37c71cd60f 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -140,6 +140,35 @@ test_expect_success $PREREQ 'Verify commandline' ' test_cmp expected commandline1 ' +test_expect_success $PREREQ 'setup expect for cc trailer' " +cat >expected-cc <<\EOF +!recipient@example.com! +!author@example.com! +!one@example.com! +!two@example.com! +!three@example.com! +!four@example.com! +!five@example.com! +EOF +" + +test_expect_success $PREREQ 'cc trailer with various syntax' ' + test_commit cc-trailer && + test_when_finished "git reset --hard HEAD^" && + git commit --amend -F - <<-EOF && + Test Cc: trailers. + + Cc: one@example.com + Cc: # this is part of the name + Cc: , # not.five@example.com + Cc: "Some # Body" [part.of.name.too] + EOF + clean_fake_sendmail && + git send-email -1 --to=recipient@example.com \ + --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 -- cgit v1.2.3 From 8a420edbd2cbe43354f03243aacd4000c0ed9cfe Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Fri, 21 Oct 2016 11:20:23 +0200 Subject: t9000-addresses: update expected results after fix e3fdbcc8e1 (parse_mailboxes: accept extra text after <...> address, 2016-10-13) improved our in-house address parser and made it closer to Mail::Address. As a consequence, some tests comparing it to Mail::Address now pass, but e3fdbcc8e1 forgot to update the test. Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- t/t9000/test.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 't') diff --git a/t/t9000/test.pl b/t/t9000/test.pl index 2d05d3eeab..dfeaa9c655 100755 --- a/t/t9000/test.pl +++ b/t/t9000/test.pl @@ -32,15 +32,15 @@ my @success_list = (q[Jane], q["Jane\" Doe" ], q[Doe, jane ], q["Jane Doe ], - q['Jane 'Doe' ]); + q['Jane 'Doe' ], + q[Jane@:;\.,()<>Doe ], + q[Jane Doe], + q[ Jane Doe]); my @known_failure_list = (q[Jane\ Doe ], q["Doe, Ja"ne ], q["Doe, Katarina" Jane ], - q[Jane@:;\.,()<>Doe ], q[Jane jdoe@example.com], - q[ Jane Doe], - q[Jane Doe], q["Jane "Kat"a" ri"na" ",Doe" ], q[Jane Doe], q[Jane "Doe "], -- cgit v1.2.3