{"thread":{"id":"9923","subject":"Re: [PATCH] git-send-email: Add a --cc-nobody option","startedAt":"2007-09-18T11:42:02Z","lastAt":"2007-09-18T13:01:55Z","messageCount":5,"participants":["Andreas Ericsson","Felipe Balbi","felipebalbi@users.sourceforge.net","Alex Unleashed"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"53465","messageId":"11901157221792-git-send-email-felipebalbi@users.sourceforge.net","threadId":"9923","inReplyTo":null,"subject":"[PATCH] git-send-email: Add a --cc-nobody option","fromName":"","fromEmail":"felipebalbi@users.sourceforge.net","sentAt":"2007-09-18T11:42:02Z","receivedAt":"2007-09-18T11:42:02Z","isPatch":true,"sender":{"key":"felipebalbi@users.sourceforge.net","avatar":null},"body":"From: Felipe Balbi <felipe.lima@indt.org.br>\n\nThis patch adds a --cc-nobody option to avoid sending emails\nto everybody but the ones listed by --to option.\n\nSigned-off-by: Felipe Balbi <felipe.lima@indt.org.br>\n---\n git-send-email.perl |   16 ++++++++++++----\n 1 files changed, 12 insertions(+), 4 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 4031e86..a5a466c 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -88,6 +88,9 @@ Options:\n    --suppress-from Suppress sending emails to yourself if your address\n                   appears in a From: line. Defaults to off.\n \n+   --cc-nobody\t  Do not send emails to anyone unless explicitly listed by\n+\t\t  --to option.\n+\n    --thread       Specify that the \"In-Reply-To:\" header should be set on all\n                   emails. Defaults to on.\n \n@@ -171,7 +174,7 @@ if ($@) {\n my ($quiet, $dry_run) = (0, 0);\n \n # Variables with corresponding config settings\n-my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);\n+my ($thread, $chain_reply_to, $suppress_from, $cc_nobody, $signed_off_cc, $cc_cmd);\n my ($smtp_server, $smtp_authuser, $smtp_authpass, $smtp_ssl);\n my ($identity, $aliasfiletype, @alias_files);\n \n@@ -179,6 +182,7 @@ my %config_bool_settings = (\n     \"thread\" => [\\$thread, 1],\n     \"chainreplyto\" => [\\$chain_reply_to, 1],\n     \"suppressfrom\" => [\\$suppress_from, 0],\n+    \"ccnobody\" => [\\$cc_nobody, 0],\n     \"signedoffcc\" => [\\$signed_off_cc, 1],\n     \"smtpssl\" => [\\$smtp_ssl, 0],\n );\n@@ -212,6 +216,7 @@ my $rc = GetOptions(\"sender|from=s\" => \\$sender,\n \t\t    \"quiet\" => \\$quiet,\n \t\t    \"cc-cmd=s\" => \\$cc_cmd,\n \t\t    \"suppress-from!\" => \\$suppress_from,\n+\t\t    \"cc-nobody!\" => \\$cc_nobody,\n \t\t    \"signed-off-cc|signed-off-by-cc!\" => \\$signed_off_cc,\n \t\t    \"dry-run\" => \\$dry_run,\n \t\t    \"envelope-sender=s\" => \\$envelope_sender,\n@@ -669,8 +674,11 @@ foreach my $t (@files) {\n \t\t\t\t\t$subject = $1;\n \n \t\t\t\t} elsif (/^(Cc|From):\\s+(.*)$/) {\n-\t\t\t\t\tif (unquote_rfc2047($2) eq $sender) {\n-\t\t\t\t\t\tnext if ($suppress_from);\n+\t\t\t\t\tif (unquote_rfc2047($2)) {\n+\t\t\t\t\t\tnext if ($cc_nobody);\n+\t\t\t\t\t}\n+\t\t\t\t\telsif (unquote_rfc2047($2) eq $sender) {\n+\t\t\t\t\t\tnext if ($suppress_from|$cc_nobody);\n \t\t\t\t\t}\n \t\t\t\t\telsif ($1 eq 'From') {\n \t\t\t\t\t\t$author = unquote_rfc2047($2);\n@@ -707,7 +715,7 @@ foreach my $t (@files) {\n \t\t\t}\n \t\t} else {\n \t\t\t$message .=  $_;\n-\t\t\tif (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {\n+\t\t\tif (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc && !$cc_nobody) {\n \t\t\t\tmy $c = $2;\n \t\t\t\tchomp $c;\n \t\t\t\tpush @cc, $c;\n-- \n1.5.3.1.91.gd3392\n"},{"id":"53454","messageId":"46EFBB5A.7090505@op5.se","threadId":"9923","inReplyTo":"11901157221792-git-send-email-felipebalbi@users.sourceforge.net","subject":"Re: [PATCH] git-send-email: Add a --cc-nobody option","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2007-09-18T11:49:46Z","receivedAt":"2007-09-18T11:49:46Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"felipebalbi@users.sourceforge.net wrote:\n> From: Felipe Balbi <felipe.lima@indt.org.br>\n> \n> This patch adds a --cc-nobody option to avoid sending emails\n> to everybody but the ones listed by --to option.\n> \n\nSounds much better than --suppress-all. Thanks\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"53456","messageId":"31e679430709180451h6e451c33lcc9c07e06cc2a869@mail.gmail.com","threadId":"9923","inReplyTo":"46EFBB5A.7090505@op5.se","subject":"Re: [PATCH] git-send-email: Add a --cc-nobody option","fromName":"Felipe Balbi","fromEmail":"felipebalbi@users.sourceforge.net","sentAt":"2007-09-18T11:51:27Z","receivedAt":"2007-09-18T11:51:27Z","isPatch":true,"sender":{"key":"felipebalbi@users.sourceforge.net","avatar":null},"body":"On 9/18/07, Andreas Ericsson <ae@op5.se> wrote:\n> felipebalbi@users.sourceforge.net wrote:\n> > From: Felipe Balbi <felipe.lima@indt.org.br>\n> >\n> > This patch adds a --cc-nobody option to avoid sending emails\n> > to everybody but the ones listed by --to option.\n> >\n>\n> Sounds much better than --suppress-all. Thanks\n\nYeah, sure...\nnp :-)\n\n>\n> --\n> Andreas Ericsson                   andreas.ericsson@op5.se\n> OP5 AB                             www.op5.se\n> Tel: +46 8-230225                  Fax: +46 8-230231\n>\n\n\n-- \nBest Regards,\n\nFelipe Balbi\nfelipebalbi@users.sourceforge.net\n"},{"id":"53468","messageId":"5e4707340709180550w3211e95fqd9fd648aab8ce78a@mail.gmail.com","threadId":"9923","inReplyTo":"11901157221792-git-send-email-felipebalbi@users.sourceforge.net","subject":"Re: [PATCH] git-send-email: Add a --cc-nobody option","fromName":"Alex Unleashed","fromEmail":"unledev@gmail.com","sentAt":"2007-09-18T12:50:10Z","receivedAt":"2007-09-18T12:50:10Z","isPatch":true,"sender":{"key":"unledev@gmail.com","avatar":null},"body":"On 9/18/07, felipebalbi@users.sourceforge.net\n<felipebalbi@users.sourceforge.net> wrote:\n> From: Felipe Balbi <felipe.lima@indt.org.br>\n>\n> This patch adds a --cc-nobody option to avoid sending emails\n> to everybody but the ones listed by --to option.\n>\n> Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>\n\nI wrote a similar patch a couple months ago, but they differ slightly,\nmaybe the code has changed somewhat:\nhttp://marc.info/?l=git&m=118200193310898&w=2\n\n--cc-nobody sounds better to me.\n\n>                                 } elsif (/^(Cc|From):\\s+(.*)$/) {\n> -                                       if (unquote_rfc2047($2) eq $sender) {\n> -                                               next if ($suppress_from);\n> +                                       if (unquote_rfc2047($2)) {\n> +                                               next if ($cc_nobody);\n> +                                       }\n> +                                       elsif (unquote_rfc2047($2) eq $sender) {\n> +                                               next if ($suppress_from|$cc_nobody);\n>                                         }\n>                                         elsif ($1 eq 'From') {\n>                                                 $author = unquote_rfc2047($2);\n\nHere you could probably skip the whole branch if you check $cc_nobody\nfirst of all.\n\n> @@ -707,7 +715,7 @@ foreach my $t (@files) {\n>                         }\n>                 } else {\n>                         $message .=  $_;\n> -                       if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {\n> +                       if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc && !$cc_nobody) {\n\nMinor, but almost the same here.\n\nAlex\n"},{"id":"53470","messageId":"31e679430709180601h15d0d315ub13bfd2c6763f181@mail.gmail.com","threadId":"9923","inReplyTo":"5e4707340709180550w3211e95fqd9fd648aab8ce78a@mail.gmail.com","subject":"Re: [PATCH] git-send-email: Add a --cc-nobody option","fromName":"Felipe Balbi","fromEmail":"felipebalbi@users.sourceforge.net","sentAt":"2007-09-18T13:01:55Z","receivedAt":"2007-09-18T13:01:55Z","isPatch":true,"sender":{"key":"felipebalbi@users.sourceforge.net","avatar":null},"body":"hi,\n\nOn 9/18/07, Alex Unleashed <unledev@gmail.com> wrote:\n> On 9/18/07, felipebalbi@users.sourceforge.net\n> <felipebalbi@users.sourceforge.net> wrote:\n> > From: Felipe Balbi <felipe.lima@indt.org.br>\n> >\n> > This patch adds a --cc-nobody option to avoid sending emails\n> > to everybody but the ones listed by --to option.\n> >\n> > Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>\n>\n> I wrote a similar patch a couple months ago, but they differ slightly,\n> maybe the code has changed somewhat:\n> http://marc.info/?l=git&m=118200193310898&w=2\n>\n> --cc-nobody sounds better to me.\n>\n> >                                 } elsif (/^(Cc|From):\\s+(.*)$/) {\n> > -                                       if (unquote_rfc2047($2) eq $sender) {\n> > -                                               next if ($suppress_from);\n> > +                                       if (unquote_rfc2047($2)) {\n> > +                                               next if ($cc_nobody);\n> > +                                       }\n> > +                                       elsif (unquote_rfc2047($2) eq $sender) {\n> > +                                               next if ($suppress_from|$cc_nobody);\n> >                                         }\n> >                                         elsif ($1 eq 'From') {\n> >                                                 $author = unquote_rfc2047($2);\n>\n> Here you could probably skip the whole branch if you check $cc_nobody\n> first of all.\n\nYeah, I tested this one too but when sending emails I was changing all\nthose From lines to my address, which means every mail I was sending\nthe patch would take my authorship.\n\nSo it looked better guaranteeing the authorship\n\n>\n> > @@ -707,7 +715,7 @@ foreach my $t (@files) {\n> >                         }\n> >                 } else {\n> >                         $message .=  $_;\n> > -                       if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {\n> > +                       if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc && !$cc_nobody) {\n>\n> Minor, but almost the same here.\n\nsanity\n\n>\n> Alex\n>\n\n\n-- \nBest Regards,\n\nFelipe Balbi\nfelipebalbi@users.sourceforge.net\n"}]}