{"thread":{"id":"8746","subject":"[PATCH 1/2] git-send-email: Add negations and config equivalents for --suppress-from and --no-signed-off-cc","startedAt":"2007-06-27T06:53:57Z","lastAt":"2007-06-27T23:47:07Z","messageCount":3,"participants":["Adam Roben"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"45894","messageId":"1182927238504-git-send-email-aroben@apple.com","threadId":"8746","inReplyTo":null,"subject":"[PATCH 1/2] git-send-email: Add negations and config equivalents for --suppress-from and --no-signed-off-cc","fromName":"Adam Roben","fromEmail":"aroben@apple.com","sentAt":"2007-06-27T06:53:57Z","receivedAt":"2007-06-27T06:53:57Z","isPatch":true,"sender":{"key":"aroben@apple.com","avatar":"https://gravatar.com/avatar/9d3697e1de53890adf241331f4b970bdd2b18962b2ff0b8028ebb00e085807f8?d=mp&s=160"},"body":"This change makes git-send-email's behavior easier to modify by adding config\nequivalents for two more of git-send-email's flags.\n\nThe mapping of flag to config setting is:\n--[no-]supress-from => sendemail.suppressfrom\n--[no-]signed-off-cc => sendemail.signedoffcc\n\nSigned-off-by: Adam Roben <aroben@apple.com>\n---\n Thanks to Junio for the suggestion for how to clean up the default values.\n\n Documentation/git-send-email.txt |   16 ++++++++++------\n git-send-email.perl              |   34 +++++++++++++++++++++-------------\n 2 files changed, 31 insertions(+), 19 deletions(-)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 946bd76..01bbd18 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -59,9 +59,11 @@ The --cc option must be repeated for each user you want on the cc list.\n \tOnly necessary if --compose is also set.  If --compose\n \tis not set, this will be prompted for.\n \n---no-signed-off-by-cc::\n-\tDo not add emails found in Signed-off-by: or Cc: lines to the\n-\tcc list.\n+--signed-off-by-cc, --no-signed-off-by-cc::\n+        If this is set, add emails found in Signed-off-by: or Cc: lines to the\n+        cc list.\n+        Default is the value of 'sendemail.signedoffbycc' configuration value;\n+        if that is unspecified, default to --signed-off-by-cc.\n \n --quiet::\n \tMake git-send-email less verbose.  One line per email should be\n@@ -82,9 +84,11 @@ The --cc option must be repeated for each user you want on the cc list.\n \tOnly necessary if --compose is also set.  If --compose\n \tis not set, this will be prompted for.\n \n---suppress-from::\n-\tDo not add the From: address to the cc: list, if it shows up in a From:\n-\tline.\n+--suppress-from, --no-suppress-from::\n+        If this is set, do not add the From: address to the cc: list, if it\n+        shows up in a From: line.\n+        Default is the value of 'sendemail.suppressfrom' configuration value;\n+        if that is unspecified, default to --no-supress-from.\n \n --dry-run::\n \tDo everything except actually send the emails.\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 9f75551..584eda9 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -64,15 +64,14 @@ Options:\n                   email sent, rather than to the first email sent.\n                   Defaults to on.\n \n-   --no-signed-off-cc Suppress the automatic addition of email addresses\n-                 that appear in Signed-off-by: or Cc: lines to the cc:\n-                 list.  Note: Using this option is not recommended.\n+   --signed-off-cc Automatically add email addresses that appear in\n+                 Signed-off-by: or Cc: lines to the cc: list. Defaults to on.\n \n    --smtp-server  If set, specifies the outgoing SMTP server to use.\n                   Defaults to localhost.\n \n    --suppress-from Suppress sending emails to yourself if your address\n-                  appears in a From: line.\n+                  appears in a From: line. Defaults to off.\n \n    --quiet\t  Make git-send-email less verbose.  One line per email\n                   should be all that is output.\n@@ -137,9 +136,6 @@ my $compose_filename = \".msg.$$\";\n my (@to,@cc,@initial_cc,@bcclist,@xh,\n \t$initial_reply_to,$initial_subject,@files,$from,$compose,$time);\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 my $smtp_server;\n my $envelope_sender;\n \n@@ -154,9 +150,21 @@ if ($@) {\n \t$term = new FakeTerm \"$@: going non-interactive\";\n }\n \n-my $def_chain = $repo->config_bool('sendemail.chainreplyto');\n-if (defined $def_chain and not $def_chain) {\n-    $chain_reply_to = 0;\n+# Behavior modification variables\n+my ($quiet, $dry_run) = (0, 0);\n+\n+# Variables with corresponding config settings\n+my ($chain_reply_to, $suppress_from, $signed_off_cc);\n+\n+my %config_settings = (\n+    \"chainreplyto\" => [\\$chain_reply_to, 1],\n+    \"suppressfrom\" => [\\$suppress_from, 0],\n+    \"signedoffcc\" => [\\$signed_off_cc, 1],\n+);\n+\n+foreach my $setting (keys %config_settings) {\n+    my $config = $repo->config_bool(\"sendemail.$setting\");\n+    ${$config_settings{$setting}->[0]} = (defined $config) ? $config : $config_settings{$setting}->[1];\n }\n \n @bcclist = $repo->config('sendemail.bcc');\n@@ -177,8 +185,8 @@ my $rc = GetOptions(\"from=s\" => \\$from,\n \t\t    \"smtp-server=s\" => \\$smtp_server,\n \t\t    \"compose\" => \\$compose,\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    \"suppress-from!\" => \\$suppress_from,\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 \t );\n@@ -609,7 +617,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 && !$no_signed_off_cc) {\n+\t\t\tif (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {\n \t\t\t\tmy $c = $2;\n \t\t\t\tchomp $c;\n \t\t\t\tpush @cc, $c;\n-- \n1.5.2.2.551.ga811\n"},{"id":"45895","messageId":"1182927238870-git-send-email-aroben@apple.com","threadId":"8746","inReplyTo":"1182927238504-git-send-email-aroben@apple.com","subject":"[PATCH 2/2] git-send-email: Add --thread option","fromName":"Adam Roben","fromEmail":"aroben@apple.com","sentAt":"2007-06-27T06:53:58Z","receivedAt":"2007-06-27T06:53:58Z","isPatch":true,"sender":{"key":"aroben@apple.com","avatar":"https://gravatar.com/avatar/9d3697e1de53890adf241331f4b970bdd2b18962b2ff0b8028ebb00e085807f8?d=mp&s=160"},"body":"The --thread option controls whether the In-Reply-To header will be set on\nany emails sent. The current behavior is to always set this header, so this\noption is most useful in its negated form, --no-thread. This behavior can\nalso be controlled through the 'sendemail.threaded' config setting.\n\nSigned-off-by: Adam Roben <aroben@apple.com>\n---\n Apologies to Junio, Matthias, and Julian, who had to endure a spamming from me\n in the development of this patch.\n\n Documentation/git-send-email.txt |    7 +++++++\n git-send-email.perl              |   11 ++++++++---\n 2 files changed, 15 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 01bbd18..293686c 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -90,6 +90,13 @@ The --cc option must be repeated for each user you want on the cc list.\n         Default is the value of 'sendemail.suppressfrom' configuration value;\n         if that is unspecified, default to --no-supress-from.\n \n+--thread, --no-thread::\n+\tIf this is set, the In-Reply-To header will be set on each email sent.\n+\tIf disabled with \"--no-thread\", no emails will have the In-Reply-To\n+\theader set.\n+\tDefault is the value of the 'sendemail.thread' configuration value;\n+\tif that is unspecified, default to --thread.\n+\n --dry-run::\n \tDo everything except actually send the emails.\n \ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 584eda9..28659f8 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -73,6 +73,9 @@ Options:\n    --suppress-from Suppress sending emails to yourself if your address\n                   appears in a From: line. Defaults to off.\n \n+    --thread      Specify that the \"In-Reply-To:\" header should be set on all\n+                  emails. Defaults to on.\n+\n    --quiet\t  Make git-send-email less verbose.  One line per email\n                   should be all that is output.\n \n@@ -154,9 +157,10 @@ if ($@) {\n my ($quiet, $dry_run) = (0, 0);\n \n # Variables with corresponding config settings\n-my ($chain_reply_to, $suppress_from, $signed_off_cc);\n+my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc);\n \n my %config_settings = (\n+    \"thread\" => [\\$thread, 1],\n     \"chainreplyto\" => [\\$chain_reply_to, 1],\n     \"suppressfrom\" => [\\$suppress_from, 0],\n     \"signedoffcc\" => [\\$signed_off_cc, 1],\n@@ -189,6 +193,7 @@ my $rc = GetOptions(\"from=s\" => \\$from,\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+\t\t    \"thread!\" => \\$thread,\n \t );\n \n unless ($rc) {\n@@ -295,7 +300,7 @@ if (!defined $initial_subject && $compose) {\n \t$prompting++;\n }\n \n-if (!defined $initial_reply_to && $prompting) {\n+if ($thread && !defined $initial_reply_to && $prompting) {\n \tdo {\n \t\t$_= $term->readline(\"Message-ID to be used as In-Reply-To for the first email? \",\n \t\t\t$initial_reply_to);\n@@ -492,7 +497,7 @@ Date: $date\n Message-Id: $message_id\n X-Mailer: git-send-email $gitversion\n \";\n-\tif ($reply_to) {\n+\tif ($thread && $reply_to) {\n \n \t\t$header .= \"In-Reply-To: $reply_to\\n\";\n \t\t$header .= \"References: $references\\n\";\n-- \n1.5.2.2.551.ga811\n"},{"id":"45938","messageId":"0A8D31B4-CD5B-4687-B80D-C9866499B2E6@apple.com","threadId":"8746","inReplyTo":"1182927238504-git-send-email-aroben@apple.com","subject":"Re: [PATCH 1/2] git-send-email: Add negations and config equivalents for --suppress-from and --no-signed-off-cc","fromName":"Adam Roben","fromEmail":"aroben@apple.com","sentAt":"2007-06-27T23:47:07Z","receivedAt":"2007-06-27T23:47:07Z","isPatch":true,"sender":{"key":"aroben@apple.com","avatar":"https://gravatar.com/avatar/9d3697e1de53890adf241331f4b970bdd2b18962b2ff0b8028ebb00e085807f8?d=mp&s=160"},"body":"    Junio, I see that you applied my previous patch to master before I  \nsent these two new ones that replace it. Would you like me to redo  \nthese patches based on master, or will you revert the old patch and  \napply these? I'm happy either way. Thanks!\n\n-Adam\n\nOn Jun 26, 2007, at 11:53 PM, Adam Roben wrote:\n\n> This change makes git-send-email's behavior easier to modify by  \n> adding config\n> equivalents for two more of git-send-email's flags.\n>\n> The mapping of flag to config setting is:\n> --[no-]supress-from => sendemail.suppressfrom\n> --[no-]signed-off-cc => sendemail.signedoffcc\n>\n> Signed-off-by: Adam Roben <aroben@apple.com>\n> ---\n> Thanks to Junio for the suggestion for how to clean up the default  \n> values.\n>\n> Documentation/git-send-email.txt |   16 ++++++++++------\n> git-send-email.perl              |   34 ++++++++++++++++++++ \n> +-------------\n> 2 files changed, 31 insertions(+), 19 deletions(-)\n>\n> diff --git a/Documentation/git-send-email.txt b/Documentation/git- \n> send-email.txt\n> index 946bd76..01bbd18 100644\n> --- a/Documentation/git-send-email.txt\n> +++ b/Documentation/git-send-email.txt\n> @@ -59,9 +59,11 @@ The --cc option must be repeated for each user  \n> you want on the cc list.\n> \tOnly necessary if --compose is also set.  If --compose\n> \tis not set, this will be prompted for.\n>\n> ---no-signed-off-by-cc::\n> -\tDo not add emails found in Signed-off-by: or Cc: lines to the\n> -\tcc list.\n> +--signed-off-by-cc, --no-signed-off-by-cc::\n> +        If this is set, add emails found in Signed-off-by: or Cc:  \n> lines to the\n> +        cc list.\n> +        Default is the value of 'sendemail.signedoffbycc'  \n> configuration value;\n> +        if that is unspecified, default to --signed-off-by-cc.\n>\n> --quiet::\n> \tMake git-send-email less verbose.  One line per email should be\n> @@ -82,9 +84,11 @@ The --cc option must be repeated for each user  \n> you want on the cc list.\n> \tOnly necessary if --compose is also set.  If --compose\n> \tis not set, this will be prompted for.\n>\n> ---suppress-from::\n> -\tDo not add the From: address to the cc: list, if it shows up in a  \n> From:\n> -\tline.\n> +--suppress-from, --no-suppress-from::\n> +        If this is set, do not add the From: address to the cc:  \n> list, if it\n> +        shows up in a From: line.\n> +        Default is the value of 'sendemail.suppressfrom'  \n> configuration value;\n> +        if that is unspecified, default to --no-supress-from.\n>\n> --dry-run::\n> \tDo everything except actually send the emails.\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index 9f75551..584eda9 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -64,15 +64,14 @@ Options:\n>                   email sent, rather than to the first email sent.\n>                   Defaults to on.\n>\n> -   --no-signed-off-cc Suppress the automatic addition of email  \n> addresses\n> -                 that appear in Signed-off-by: or Cc: lines to the  \n> cc:\n> -                 list.  Note: Using this option is not recommended.\n> +   --signed-off-cc Automatically add email addresses that appear in\n> +                 Signed-off-by: or Cc: lines to the cc: list.  \n> Defaults to on.\n>\n>    --smtp-server  If set, specifies the outgoing SMTP server to use.\n>                   Defaults to localhost.\n>\n>    --suppress-from Suppress sending emails to yourself if your address\n> -                  appears in a From: line.\n> +                  appears in a From: line. Defaults to off.\n>\n>    --quiet\t  Make git-send-email less verbose.  One line per email\n>                   should be all that is output.\n> @@ -137,9 +136,6 @@ my $compose_filename = \".msg.$$\";\n> my (@to,@cc,@initial_cc,@bcclist,@xh,\n> \t$initial_reply_to,$initial_subject,@files,$from,$compose,$time);\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> my $smtp_server;\n> my $envelope_sender;\n>\n> @@ -154,9 +150,21 @@ if ($@) {\n> \t$term = new FakeTerm \"$@: going non-interactive\";\n> }\n>\n> -my $def_chain = $repo->config_bool('sendemail.chainreplyto');\n> -if (defined $def_chain and not $def_chain) {\n> -    $chain_reply_to = 0;\n> +# Behavior modification variables\n> +my ($quiet, $dry_run) = (0, 0);\n> +\n> +# Variables with corresponding config settings\n> +my ($chain_reply_to, $suppress_from, $signed_off_cc);\n> +\n> +my %config_settings = (\n> +    \"chainreplyto\" => [\\$chain_reply_to, 1],\n> +    \"suppressfrom\" => [\\$suppress_from, 0],\n> +    \"signedoffcc\" => [\\$signed_off_cc, 1],\n> +);\n> +\n> +foreach my $setting (keys %config_settings) {\n> +    my $config = $repo->config_bool(\"sendemail.$setting\");\n> +    ${$config_settings{$setting}->[0]} = (defined $config) ?  \n> $config : $config_settings{$setting}->[1];\n> }\n>\n> @bcclist = $repo->config('sendemail.bcc');\n> @@ -177,8 +185,8 @@ my $rc = GetOptions(\"from=s\" => \\$from,\n> \t\t    \"smtp-server=s\" => \\$smtp_server,\n> \t\t    \"compose\" => \\$compose,\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    \"suppress-from!\" => \\$suppress_from,\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> \t );\n> @@ -609,7 +617,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 && !$no_signed_off_cc) {\n> +\t\t\tif (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {\n> \t\t\t\tmy $c = $2;\n> \t\t\t\tchomp $c;\n> \t\t\t\tpush @cc, $c;\n> -- \n> 1.5.2.2.551.ga811\n>\n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"}]}