git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Rasmus Villemoes <rv@rasmusvillemoes.dk>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Rasmus Villemoes <rv@rasmusvillemoes.dk>
Subject: [PATCH v2 2/3] send-email: only consider lines containing @ or <> for automatic Cc'ing
Date: Tue, 16 Oct 2018 09:39:22 +0200	[thread overview]
Message-ID: <20181016073923.28134-3-rv@rasmusvillemoes.dk> (raw)
In-Reply-To: <20181016073923.28134-1-rv@rasmusvillemoes.dk>

While the address sanitizations routines do accept local addresses, that
is almost never what is meant in a Cc or Signed-off-by trailer.

Looking through all the signed-off-by lines in the linux kernel tree
without a @, there are mostly two patterns: Either just a full name, or
a full name followed by <user at domain.com> (i.e., with the word at
instead of a @), and minor variations. For cc lines, the same patterns
appear, along with lots of "cc stable" variations that do not actually
name stable@vger.kernel.org

  Cc: stable # introduced pre-git times
  cc: stable.kernel.org

In the <user at domain.com> cases, one gets a chance to interactively
fix it. But when there is no <> pair, it seems we end up just using the
first word as a (local) address.

As the number of cases where a local address really was meant is
likely (and anecdotally) quite small compared to the number of cases
where we end up cc'ing a garbage address, insist on at least a @ or a <>
pair being present.

This is also preparation for the next patch, where we are likely to
encounter even more non-addresses in -by lines, such as

  Reported-by: Coverity
  Patch-generated-by: Coccinelle

Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
---
 git-send-email.perl | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/git-send-email.perl b/git-send-email.perl
index 2be5dac337..1916159d2a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1694,6 +1694,11 @@ sub process_file {
 				next if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i;
 				next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
 			}
+			if ($c !~ /.+@.+|<.+>/) {
+				printf("(body) Ignoring %s from line '%s'\n",
+					$what, $_) unless $quiet;
+				next;
+			}
 			push @cc, $c;
 			printf(__("(body) Adding cc: %s from line '%s'\n"),
 				$c, $_) unless $quiet;
-- 
2.19.1.6.gbde171bbf5


  parent reply	other threads:[~2018-10-16  7:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 11:13 [PATCH 0/3] send-email: Also pick up cc addresses from -by trailers Rasmus Villemoes
2018-10-10 11:13 ` [PATCH 1/3] Documentation/git-send-email.txt: style fixes Rasmus Villemoes
2018-10-10 11:13 ` [PATCH 2/3] send-email: only consider lines containing @ or <> for automatic Cc'ing Rasmus Villemoes
2018-10-10 12:57   ` Ævar Arnfjörð Bjarmason
2018-10-10 13:29     ` Rasmus Villemoes
2018-10-11  6:06       ` Junio C Hamano
2018-10-11  7:06         ` Rasmus Villemoes
2018-10-11  8:22           ` Junio C Hamano
2018-10-10 11:13 ` [PATCH 3/3] send-email: also pick up cc addresses from -by trailers Rasmus Villemoes
2018-10-10 12:51   ` Ævar Arnfjörð Bjarmason
2018-10-11  6:18   ` Junio C Hamano
2018-10-11  7:11     ` Rasmus Villemoes
2018-10-16  5:57       ` Junio C Hamano
2018-10-16  7:17         ` Rasmus Villemoes
2018-10-16  7:46           ` Junio C Hamano
2018-10-16  7:39 ` [PATCH v2 0/3] send-email: Also " Rasmus Villemoes
2018-10-16  7:39   ` [PATCH v2 1/3] Documentation/git-send-email.txt: style fixes Rasmus Villemoes
2018-10-16  7:39   ` Rasmus Villemoes [this message]
2018-10-16  7:39   ` [PATCH v2 3/3] send-email: also pick up cc addresses from -by trailers Rasmus Villemoes
2018-10-16  7:57   ` [PATCH v2 0/3] send-email: Also " Junio C Hamano

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=20181016073923.28134-3-rv@rasmusvillemoes.dk \
    --to=rv@rasmusvillemoes.dk \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).