summaryrefslogtreecommitdiff
path: root/t/t9001-send-email.sh
diff options
context:
space:
mode:
authorMatthieu Moy <git@matthieu-moy.fr>2017-08-23 10:21:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-24 21:40:15 (GMT)
commitcb2922fe4b2a82e2174d419781836e768651ebff (patch)
tree4d0d7af22e2d52a1acbecfd43017f0cc77a17923 /t/t9001-send-email.sh
parentedc74bc7f0c6884027e851ef09b2e0c9380dcd45 (diff)
downloadgit-cb2922fe4b2a82e2174d419781836e768651ebff.zip
git-cb2922fe4b2a82e2174d419781836e768651ebff.tar.gz
git-cb2922fe4b2a82e2174d419781836e768651ebff.tar.bz2
send-email: fix garbage removal after address
This is a followup over 9d33439 (send-email: only allow one address per body tag, 2017-02-20). The first iteration did allow writting Cc: <foo@example.com> # garbage but did so by matching the regex ([^>]*>?), i.e. stop after the first instance of '>'. However, it did not properly deal with Cc: foo@example.com # garbage Fix this using a new function strip_garbage_one_address, which does essentially what the old ([^>]*>?) was doing, but dealing with more corner-cases. Since we've allowed Cc: "Foo # Bar" <foobar@example.com> in previous versions, it makes sense to continue allowing it (but we still remove any garbage after it). OTOH, when an address is given without quoting, we just take the first word and ignore everything after. Signed-off-by: Matthieu Moy <git@matthieu-moy.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9001-send-email.sh')
-rwxr-xr-xt/t9001-send-email.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index d1e4e8a..f309808 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -148,6 +148,8 @@ cat >expected-cc <<\EOF
!two@example.com!
!three@example.com!
!four@example.com!
+!five@example.com!
+!six@example.com!
EOF
"
@@ -161,6 +163,8 @@ test_expect_success $PREREQ 'cc trailer with various syntax' '
Cc: <two@example.com> # trailing comments are ignored
Cc: <three@example.com>, <not.four@example.com> one address per line
Cc: "Some # Body" <four@example.com> [ <also.a.comment> ]
+ Cc: five@example.com # not.six@example.com
+ Cc: six@example.com, not.seven@example.com
EOF
clean_fake_sendmail &&
git send-email -1 --to=recipient@example.com \