{"thread":{"id":"8739","subject":"[PATCH] git-send-email: Add --threaded option","startedAt":"2007-06-26T22:48:30Z","lastAt":"2007-06-27T06:03:20Z","messageCount":4,"participants":["Adam Roben","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"45857","messageId":"11828981103069-git-send-email-aroben@apple.com","threadId":"8739","inReplyTo":null,"subject":"[PATCH] git-send-email: Add --threaded option","fromName":"Adam Roben","fromEmail":"aroben@apple.com","sentAt":"2007-06-26T22:48:30Z","receivedAt":"2007-06-26T22:48:30Z","isPatch":true,"sender":{"key":"aroben@apple.com","avatar":"https://gravatar.com/avatar/9d3697e1de53890adf241331f4b970bdd2b18962b2ff0b8028ebb00e085807f8?d=mp&s=160"},"body":"The --threaded 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-threaded. This behavior can\nalso be controlled through the 'sendemail.threaded' config setting.\n\nSigned-off-by: Adam Roben <aroben@apple.com>\n---\n Documentation/git-send-email.txt |    7 +++++++\n git-send-email.perl              |   25 ++++++++++++++++++-------\n 2 files changed, 25 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 946bd76..1f5d57d 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -86,6 +86,13 @@ The --cc option must be repeated for each user you want on the cc list.\n \tDo not add the From: address to the cc: list, if it shows up in a From:\n \tline.\n \n+--threaded, --no-threaded::\n+\tIf this is set, the In-Reply-To header will be set on each email sent.\n+\tIf disabled with \"--no-threaded\", no emails will have the In-Reply-To\n+\theader set.\n+\tDefault is the value of the 'sendemail.threaded' configuration value;\n+\tif that is unspecified, default to --threaded.\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 9f75551..b8b8fe7 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -74,6 +74,9 @@ Options:\n    --suppress-from Suppress sending emails to yourself if your address\n                   appears in a From: line.\n \n+    --threaded    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@@ -138,8 +141,8 @@ 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 ($threaded, $chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,\n+\t$dry_run) = (1, 1, 0, 0, 0, 0);\n my $smtp_server;\n my $envelope_sender;\n \n@@ -154,9 +157,16 @@ 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+my %config_settings = (\n+    \"threaded\" => \\$threaded,\n+    \"chainreplyto\" => \\$chain_reply_to,\n+);\n+\n+foreach my $setting (keys %config_settings) {\n+    my $default = $repo->config_bool(\"sendemail.$setting\");\n+    if (defined $default) {\n+        $config_settings{$setting} = $default ? 1 : 0;\n+    }\n }\n \n @bcclist = $repo->config('sendemail.bcc');\n@@ -181,6 +191,7 @@ my $rc = GetOptions(\"from=s\" => \\$from,\n \t\t    \"no-signed-off-cc|no-signed-off-by-cc\" => \\$no_signed_off_cc,\n \t\t    \"dry-run\" => \\$dry_run,\n \t\t    \"envelope-sender=s\" => \\$envelope_sender,\n+\t\t    \"threaded!\" => \\$threaded,\n \t );\n \n unless ($rc) {\n@@ -287,7 +298,7 @@ if (!defined $initial_subject && $compose) {\n \t$prompting++;\n }\n \n-if (!defined $initial_reply_to && $prompting) {\n+if ($threaded && !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@@ -484,7 +495,7 @@ Date: $date\n Message-Id: $message_id\n X-Mailer: git-send-email $gitversion\n \";\n-\tif ($reply_to) {\n+\tif ($threaded && $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.549.gaeb59-dirty\n"},{"id":"45888","messageId":"7vvedaq8eg.fsf@assigned-by-dhcp.pobox.com","threadId":"8739","inReplyTo":"11828981103069-git-send-email-aroben@apple.com","subject":"Re: [PATCH] git-send-email: Add --threaded option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-27T05:21:59Z","receivedAt":"2007-06-27T05:21:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Adam Roben <aroben@apple.com> writes:\n\n> The --threaded option controls whether the In-Reply-To header will be set on\n> any emails sent. The current behavior is to always set this header, so this\n> option is most useful in its negated form, --no-threaded. This behavior can\n> also be controlled through the 'sendemail.threaded' config setting.\n>\n> Signed-off-by: Adam Roben <aroben@apple.com>\n\nThanks.  I've always felt that send-email has too much built-in\npolicy; I think this is a sensible change.\n\n> @@ -138,8 +141,8 @@ 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 ($threaded, $chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,\n> +\t$dry_run) = (1, 1, 0, 0, 0, 0);\n\nWhile we are at it, you might want to make everything other than\nquiet and dry_run overridable the same way.\n"},{"id":"45889","messageId":"70B55529-9309-46D4-89A0-3FFD4D4E0660@apple.com","threadId":"8739","inReplyTo":"7vvedaq8eg.fsf@assigned-by-dhcp.pobox.com","subject":"Re: [PATCH] git-send-email: Add --threaded option","fromName":"Adam Roben","fromEmail":"aroben@apple.com","sentAt":"2007-06-27T05:32:03Z","receivedAt":"2007-06-27T05:32:03Z","isPatch":true,"sender":{"key":"aroben@apple.com","avatar":"https://gravatar.com/avatar/9d3697e1de53890adf241331f4b970bdd2b18962b2ff0b8028ebb00e085807f8?d=mp&s=160"},"body":"On Jun 26, 2007, at 10:21 PM, Junio C Hamano wrote:\n\n> Adam Roben <aroben@apple.com> writes:\n>\n>> @@ -138,8 +141,8 @@ 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 ($threaded, $chain_reply_to, $quiet, $suppress_from,  \n>> $no_signed_off_cc,\n>> +\t$dry_run) = (1, 1, 0, 0, 0, 0);\n>\n> While we are at it, you might want to make everything other than\n> quiet and dry_run overridable the same way.\n\n    --[no-]chain-reply-to, --suppress-from and --no-signed-off-cc  \nalready exist, so do you mean that we should support --no-suppress- \nfrom and --signed-off-cc (i.e., the negations) as well? Or that we  \nshould have equivalent config settings for these? Or both?\n\n    I also realized after sending this that git-format-patch has a -- \n[no-]thread option, so I think I'll change the name of this option to  \nmatch.\n\n-Adam\n"},{"id":"45891","messageId":"7vmyymq6hj.fsf@assigned-by-dhcp.pobox.com","threadId":"8739","inReplyTo":"70B55529-9309-46D4-89A0-3FFD4D4E0660@apple.com","subject":"Re: [PATCH] git-send-email: Add --threaded option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-27T06:03:20Z","receivedAt":"2007-06-27T06:03:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Adam Roben <aroben@apple.com> writes:\n\n> On Jun 26, 2007, at 10:21 PM, Junio C Hamano wrote:\n> ...\n>>> +my ($threaded, $chain_reply_to, $quiet, $suppress_from,\n>>> $no_signed_off_cc,\n>>> +\t$dry_run) = (1, 1, 0, 0, 0, 0);\n>>\n>> While we are at it, you might want to make everything other than\n>> quiet and dry_run overridable the same way.\n>\n>    --[no-]chain-reply-to, --suppress-from and --no-signed-off-cc\n> already exist, so do you mean that we should support --no-suppress-\n> from and --signed-off-cc (i.e., the negations) as well? Or that we\n> should have equivalent config settings for these? Or both?\n\nSorry for being unclear; I was talking about the config.\n\nAlso \"my ($a, $b, $c, ...) = ($defA, $defB, $defC, ...)\" gets\nextremely hard to read when the list grows longer.  I was hoping\nthat when adding entries to %config_settings array, you would do\nsomething like:\n\n\tmy %config_settings = (\n                threaded => [\\threaded, 1],\n                chainreplyto => [\\chain_reply_to, 1],\n\t\t...\n\t);\n\twhile (my ($var, $data) = each %config_settings) {\n        \tmy $config = $repo_config_bool(\"sendemail.$var);\n\t\t${$data->[0]} = (defined $config) ? $config : $data->[1];\n\t}\n"}]}