{"thread":{"id":"8614","subject":"[PATCH] Add --skip-from-cc option to git-send-email to prevent mailing to From: and Cc: addresses in patch headers","startedAt":"2007-06-16T14:00:25Z","lastAt":"2007-06-16T14:00:25Z","messageCount":1,"participants":["Alex Unleashed"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"45161","messageId":"11820024254060-git-send-email-unledev@gmail.com","threadId":"8614","inReplyTo":null,"subject":"[PATCH] Add --skip-from-cc option to git-send-email to prevent mailing to From: and Cc: addresses in patch headers","fromName":"Alex Unleashed","fromEmail":"unledev@gmail.com","sentAt":"2007-06-16T14:00:25Z","receivedAt":"2007-06-16T14:00:25Z","isPatch":true,"sender":{"key":"unledev@gmail.com","avatar":null},"body":"This applies only to From: and Cc: lines in headers, not the body, so\nthat --no-signed-off-by-cc still applies for those.\n\nSigned-off-by: Alex Unleashed <unledev@gmail.com>\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 946bd76..7c9fded 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -67,6 +67,10 @@ The --cc option must be repeated for each user you want on the cc list.\n \tMake git-send-email less verbose.  One line per email should be\n \tall that is output.\n \n+--skip-from-cc::\n+\tDo not add emails found in From: or Cc: headers in patches.\n+\tNote that this does not apply to addresses in patch bodies.\n+\n --smtp-server::\n \tIf set, specifies the outgoing SMTP server to use (e.g.\n \t`smtp.example.com` or a raw IP address).  Alternatively it can\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 7c0c90b..35a0e6c 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -68,6 +68,9 @@ Options:\n                  that appear in Signed-off-by: or Cc: lines to the cc:\n                  list.  Note: Using this option is not recommended.\n \n+   --skip-from-cc Do not send email to From: and Cc: addresses from headers\n+                  in patches.\n+\n    --smtp-server  If set, specifies the outgoing SMTP server to use.\n                   Defaults to localhost.\n \n@@ -139,7 +142,7 @@ my (@to,@cc,@initial_cc,@bcclist,@xh,\n \n # Behavior modification variables\n my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,\n-\t$dry_run) = (1, 0, 0, 0, 0);\n+\t$skip_from_cc, $dry_run) = (1, 0, 0, 0, 0, 0);\n my $smtp_server;\n my $envelope_sender;\n \n@@ -179,6 +182,7 @@ my $rc = GetOptions(\"from=s\" => \\$from,\n \t\t    \"quiet\" => \\$quiet,\n \t\t    \"suppress-from\" => \\$suppress_from,\n \t\t    \"no-signed-off-cc|no-signed-off-by-cc\" => \\$no_signed_off_cc,\n+\t\t    \"skip-from-cc\" => \\$skip_from_cc,\n \t\t    \"dry-run\" => \\$dry_run,\n \t\t    \"envelope-sender=s\" => \\$envelope_sender,\n \t );\n@@ -560,7 +564,7 @@ foreach my $t (@files) {\n \t\t\t\tif (/^Subject:\\s+(.*)$/) {\n \t\t\t\t\t$subject = $1;\n \n-\t\t\t\t} elsif (/^(Cc|From):\\s+(.*)$/) {\n+\t\t\t\t} elsif (!$skip_from_cc && /^(Cc|From):\\s+(.*)$/) {\n \t\t\t\t\tif (unquote_rfc2047($2) eq $from) {\n \t\t\t\t\t\t$from = $2;\n \t\t\t\t\t\tnext if ($suppress_from);\n@@ -583,7 +587,7 @@ foreach my $t (@files) {\n \t\t\t\t# line 2 = subject\n \t\t\t\t# So let's support that, too.\n \t\t\t\t$input_format = 'lots';\n-\t\t\t\tif (@cc == 0) {\n+\t\t\t\tif (!$skip_from_cc && @cc == 0) {\n \t\t\t\t\tprintf(\"(non-mbox) Adding cc: %s from line '%s'\\n\",\n \t\t\t\t\t\t$_, $_) unless $quiet;\n \n-- \n1.5.2.1\n"}]}