Skip to content

Commit

Permalink
git-send-email: Add --threaded option
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Adam Roben authored and Junio C Hamano committed Jun 27, 2007
1 parent 384f122 commit e46f7a0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
7 changes: 7 additions & 0 deletions Documentation/git-send-email.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ The --cc option must be repeated for each user you want on the cc list.
Do not add the From: address to the cc: list, if it shows up in a From:
line.

--threaded, --no-threaded::
If this is set, the In-Reply-To header will be set on each email sent.
If disabled with "--no-threaded", no emails will have the In-Reply-To
header set.
Default is the value of the 'sendemail.threaded' configuration value;
if that is unspecified, default to --threaded.

--dry-run::
Do everything except actually send the emails.

Expand Down
25 changes: 18 additions & 7 deletions git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ sub usage {
--suppress-from Suppress sending emails to yourself if your address
appears in a From: line.
--threaded Specify that the "In-Reply-To:" header should be set on all
emails. Defaults to on.
--quiet Make git-send-email less verbose. One line per email
should be all that is output.
Expand Down Expand Up @@ -138,8 +141,8 @@ sub format_2822_time {
$initial_reply_to,$initial_subject,@files,$from,$compose,$time);

# Behavior modification variables
my ($chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
$dry_run) = (1, 0, 0, 0, 0);
my ($threaded, $chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
$dry_run) = (1, 1, 0, 0, 0, 0);
my $smtp_server;
my $envelope_sender;

Expand All @@ -154,9 +157,16 @@ sub format_2822_time {
$term = new FakeTerm "$@: going non-interactive";
}

my $def_chain = $repo->config_bool('sendemail.chainreplyto');
if (defined $def_chain and not $def_chain) {
$chain_reply_to = 0;
my %config_settings = (
"threaded" => \$threaded,
"chainreplyto" => \$chain_reply_to,
);

foreach my $setting (keys %config_settings) {
my $default = $repo->config_bool("sendemail.$setting");
if (defined $default) {
$config_settings{$setting} = $default ? 1 : 0;
}
}

@bcclist = $repo->config('sendemail.bcc');
Expand All @@ -181,6 +191,7 @@ sub format_2822_time {
"no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
"dry-run" => \$dry_run,
"envelope-sender=s" => \$envelope_sender,
"threaded!" => \$threaded,
);

unless ($rc) {
Expand Down Expand Up @@ -287,7 +298,7 @@ sub expand_aliases {
$prompting++;
}

if (!defined $initial_reply_to && $prompting) {
if ($threaded && !defined $initial_reply_to && $prompting) {
do {
$_= $term->readline("Message-ID to be used as In-Reply-To for the first email? ",
$initial_reply_to);
Expand Down Expand Up @@ -484,7 +495,7 @@ sub send_message
Message-Id: $message_id
X-Mailer: git-send-email $gitversion
";
if ($reply_to) {
if ($threaded && $reply_to) {

$header .= "In-Reply-To: $reply_to\n";
$header .= "References: $references\n";
Expand Down

0 comments on commit e46f7a0

Please sign in to comment.