git-send-email: Add --threaded option
The --threaded option controls whether the In-Reply-To header will be set on any emails sent. The current behavior is to always set this header, so this option is most useful in its negated form, --no-threaded. This behavior can also be controlled through the 'sendemail.threaded' config setting. Signed-off-by: Adam Roben <aroben@apple.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Adam Roben committed
Jun 26, 2007 at 15:48 UTC
e46f7a0e1c641cd80affd80516677f1e370cd72c
2 files changed
+25
-7
Documentation/git-send-email.txt
+7
@@ -86,6 +86,13 @@ The --cc option must be repeated for each user you want on the cc list.
86
Do not add the From: address to the cc: list, if it shows up in a From:
87
line.
88
89
+--threaded, --no-threaded::
90
+ If this is set, the In-Reply-To header will be set on each email sent.
91
+ If disabled with "--no-threaded", no emails will have the In-Reply-To
92
+ header set.
93
+ Default is the value of the 'sendemail.threaded' configuration value;
94
+ if that is unspecified, default to --threaded.
95
+
96
--dry-run::
97
Do everything except actually send the emails.
98
git-send-email.perl
+18
-7
@@ -74,6 +74,9 @@ Options:
74
--suppress-from Suppress sending emails to yourself if your address
75
appears in a From: line.
76
77
+ --threaded Specify that the "In-Reply-To:" header should be set on all
78
+ emails. Defaults to on.
79
+
80
--quiet Make git-send-email less verbose. One line per email
81
should be all that is output.
82
@@ -138,8 +141,8 @@ my (@to,@cc,@initial_cc,@bcclist,@xh,
141
$initial_reply_to,$initial_subject,@files,$from,$compose,$time);
142
143
# Behavior modification variables
141
-my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
142
- $dry_run) = (1, 0, 0, 0, 0);
144
+my ($threaded, $chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
145
+ $dry_run) = (1, 1, 0, 0, 0, 0);
146
my $smtp_server;
147
my $envelope_sender;
148
@@ -154,9 +157,16 @@ if ($@) {
157
$term = new FakeTerm "$@: going non-interactive";
158
}
159
157
-my $def_chain = $repo->config_bool('sendemail.chainreplyto');
158
-if (defined $def_chain and not $def_chain) {
159
- $chain_reply_to = 0;
160
+my %config_settings = (
161
+ "threaded" => \$threaded,
162
+ "chainreplyto" => \$chain_reply_to,
163
+);
164
+
165
+foreach my $setting (keys %config_settings) {
166
+ my $default = $repo->config_bool("sendemail.$setting");
167
+ if (defined $default) {
168
+ $config_settings{$setting} = $default ? 1 : 0;
169
+ }
170
}
171
172
@bcclist = $repo->config('sendemail.bcc');
@@ -181,6 +191,7 @@ my $rc = GetOptions("from=s" => \$from,
191
"no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
192
"dry-run" => \$dry_run,
193
"envelope-sender=s" => \$envelope_sender,
194
+ "threaded!" => \$threaded,
195
);
196
197
unless ($rc) {
@@ -287,7 +298,7 @@ if (!defined $initial_subject && $compose) {
298
$prompting++;
299
}
300
290
-if (!defined $initial_reply_to && $prompting) {
301
+if ($threaded && !defined $initial_reply_to && $prompting) {
302
do {
303
$_= $term->readline("Message-ID to be used as In-Reply-To for the first email? ",
304
$initial_reply_to);
@@ -484,7 +495,7 @@ Date: $date
495
Message-Id: $message_id
496
X-Mailer: git-send-email $gitversion
497
";
487
- if ($reply_to) {
498
+ if ($threaded && $reply_to) {
499
500
$header .= "In-Reply-To: $reply_to\n";
501
$header .= "References: $references\n";