git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
	Jeff King <peff@peff.net>, Kevin Daudt <me@ikke.info>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	git@vger.kernel.org, Johan Hovold <johan@kernel.org>
Subject: [PATCH v2] send-email: only allow one address per body tag
Date: Mon, 20 Feb 2017 12:44:06 +0100	[thread overview]
Message-ID: <20170220114406.19436-1-johan@kernel.org> (raw)
In-Reply-To: <xmqqbmu0pgg6.fsf@gitster.mtv.corp.google.com>

Adding comments after a tag in the body is a common practise (e.g. in
the Linux kernel) and git-send-email has been supporting this for years
by removing any trailing cruft after the address.

After some recent changes, any trailing comment is now instead appended
to the recipient name (with some random white space inserted) resulting
in undesirable noise in the headers, for example:

CC: "# 3 . 3 . x : 1b9508f : sched : Rate-limit newidle" <stable@vger.kernel.org>

Revert to the earlier behaviour of discarding anything after the (first)
address in a tag while parsing the body.

Note that multiple addresses after are still allowed after a command
line switch (and in a CC header field).

Also note that --suppress-cc=self was never honoured when using multiple
addresses in a tag.

Fixes: b1c8a11c8024 ("send-email: allow multiple emails using --cc, --to
and --bcc")
Fixes: e3fdbcc8e164 ("parse_mailboxes: accept extra text after <...>
address")
Signed-off-by: Johan Hovold <johan@kernel.org>
---

v2:
 - update the cc-trailer test
 - amend commit message and mention the broken --suppress-cc=self


 git-send-email.perl   | 2 +-
 t/t9001-send-email.sh | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 068d60b3e698..eea0a517f71b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1563,7 +1563,7 @@ foreach my $t (@files) {
 	# Now parse the message body
 	while(<$fh>) {
 		$message .=  $_;
-		if (/^(Signed-off-by|Cc): (.*)$/i) {
+		if (/^(Signed-off-by|Cc): ([^>]*>?)/i) {
 			chomp;
 			my ($what, $c) = ($1, $2);
 			chomp $c;
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 0f398dd1603d..60a80f60b268 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -148,7 +148,6 @@ cat >expected-cc <<\EOF
 !two@example.com!
 !three@example.com!
 !four@example.com!
-!five@example.com!
 EOF
 "
 
@@ -159,9 +158,9 @@ test_expect_success $PREREQ 'cc trailer with various syntax' '
 	Test Cc: trailers.
 
 	Cc: one@example.com
-	Cc: <two@example.com> # this is part of the name
-	Cc: <three@example.com>, <four@example.com> # not.five@example.com
-	Cc: "Some # Body" <five@example.com> [part.of.name.too]
+	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> ]
 	EOF
 	clean_fake_sendmail &&
 	git send-email -1 --to=recipient@example.com \
-- 
2.11.1


  reply	other threads:[~2017-02-20 11:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 17:49 body-CC-comment regression Johan Hovold
2017-02-16 17:59 ` Junio C Hamano
2017-02-16 18:14   ` Johan Hovold
2017-02-16 18:16 ` Matthieu Moy
2017-02-17 11:06   ` Johan Hovold
2017-02-17 13:16     ` Matthieu Moy
2017-02-17 16:42       ` Johan Hovold
2017-02-17 16:58         ` Matthieu Moy
2017-02-17 17:30           ` Johan Hovold
2017-02-17 18:18           ` Junio C Hamano
2017-02-17 18:23             ` Johan Hovold
2017-02-17 18:28               ` Junio C Hamano
2017-02-17 18:44                 ` Matthieu Moy
2017-02-17 20:05                   ` Junio C Hamano
2017-02-17 20:20                     ` Matthieu Moy
2017-02-17 22:22                       ` Junio C Hamano
2017-02-17 23:04                         ` Junio C Hamano
2017-02-20 11:44                           ` Johan Hovold [this message]
2017-02-20 12:10                             ` [PATCH v2] send-email: only allow one address per body tag Matthieu Moy
2017-02-23 18:53                               ` Junio C Hamano
2017-02-26 20:45                                 ` Matthieu Moy
2017-02-17 17:38       ` body-CC-comment regression Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170220114406.19436-1-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=Larry.Finger@lwfinger.net \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@ikke.info \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).