All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add --skip-from-cc option to git-send-email to prevent mailing to From: and Cc: addresses in patch headers
@ 2007-06-16 14:00 Alex Unleashed, Alex Unleashed
  0 siblings, 0 replies; only message in thread
From: Alex Unleashed, Alex Unleashed @ 2007-06-16 14:00 UTC (permalink / raw)
  To: git

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-06-16 13:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-16 14:00 [PATCH] Add --skip-from-cc option to git-send-email to prevent mailing to From: and Cc: addresses in patch headers Alex Unleashed, Alex Unleashed

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.