git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Add --skip-from-cc option to git-send-email to prevent mailing to From: and Cc: addresses in patch headers

From
AUAlex Unleashed <unledev@gmail.com>
Date
Jun 16, 2007, 14:00 UTC
Message-ID
<11820024254060-git-send-email-unledev@gmail.com>

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
Message 1 of 1 in “Add --skip-from-cc option to git-send-email to prevent mailing to From: and Cc: addresses in patch headers”
  1. Add --skip-from-cc option to git-send-email to prevent mailing to From: and Cc: addresses in patch headersAlex Unleashed, Jun 16, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.