{"thread":{"id":"8740","subject":"[PATCH] git-send-email: Add --threaded option","startedAt":"2007-06-26T22:57:40Z","lastAt":"2007-06-26T22:57:40Z","messageCount":1,"participants":["Adam Roben"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"45858","messageId":"11828986601206-git-send-email-aroben@apple.com","threadId":"8740","inReplyTo":null,"subject":"[PATCH] git-send-email: Add --threaded option","fromName":"Adam Roben","fromEmail":"aroben@apple.com","sentAt":"2007-06-26T22:57:40Z","receivedAt":"2007-06-26T22:57:40Z","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"}]}