git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Unleashed <unledev@gmail.com>
From: Alex Unleashed <unledev@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] Add --skip-from-cc option to git-send-email to prevent mailing to From: and Cc: addresses in patch headers
Date: Sat, 16 Jun 2007 16:00:25 +0200	[thread overview]
Message-ID: <11820024254060-git-send-email-unledev@gmail.com> (raw)

This applies only to From: and Cc: lines in headers, not the body, so
that --no-signed-off-by-cc still applies for those.

Signed-off-by: Alex Unleashed <unledev@gmail.com>

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 946bd76..7c9fded 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -67,6 +67,10 @@ The --cc option must be repeated for each user you want on the cc list.
 	Make git-send-email less verbose.  One line per email should be
 	all that is output.
 
+--skip-from-cc::
+	Do not add emails found in From: or Cc: headers in patches.
+	Note that this does not apply to addresses in patch bodies.
+
 --smtp-server::
 	If set, specifies the outgoing SMTP server to use (e.g.
 	`smtp.example.com` or a raw IP address).  Alternatively it can
diff --git a/git-send-email.perl b/git-send-email.perl
index 7c0c90b..35a0e6c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -68,6 +68,9 @@ Options:
                  that appear in Signed-off-by: or Cc: lines to the cc:
                  list.  Note: Using this option is not recommended.
 
+   --skip-from-cc Do not send email to From: and Cc: addresses from headers
+                  in patches.
+
    --smtp-server  If set, specifies the outgoing SMTP server to use.
                   Defaults to localhost.
 
@@ -139,7 +142,7 @@ my (@to,@cc,@initial_cc,@bcclist,@xh,
 
 # Behavior modification variables
 my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
-	$dry_run) = (1, 0, 0, 0, 0);
+	$skip_from_cc, $dry_run) = (1, 0, 0, 0, 0, 0);
 my $smtp_server;
 my $envelope_sender;
 
@@ -179,6 +182,7 @@ my $rc = GetOptions("from=s" => \$from,
 		    "quiet" => \$quiet,
 		    "suppress-from" => \$suppress_from,
 		    "no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
+		    "skip-from-cc" => \$skip_from_cc,
 		    "dry-run" => \$dry_run,
 		    "envelope-sender=s" => \$envelope_sender,
 	 );
@@ -560,7 +564,7 @@ foreach my $t (@files) {
 				if (/^Subject:\s+(.*)$/) {
 					$subject = $1;
 
-				} elsif (/^(Cc|From):\s+(.*)$/) {
+				} elsif (!$skip_from_cc && /^(Cc|From):\s+(.*)$/) {
 					if (unquote_rfc2047($2) eq $from) {
 						$from = $2;
 						next if ($suppress_from);
@@ -583,7 +587,7 @@ foreach my $t (@files) {
 				# line 2 = subject
 				# So let's support that, too.
 				$input_format = 'lots';
-				if (@cc == 0) {
+				if (!$skip_from_cc && @cc == 0) {
 					printf("(non-mbox) Adding cc: %s from line '%s'\n",
 						$_, $_) unless $quiet;
 
-- 
1.5.2.1

                 reply	other threads:[~2007-06-16 13:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

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

  git send-email \
    --in-reply-to=11820024254060-git-send-email-unledev@gmail.com \
    --to=unledev@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).