diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-11-30 14:35:18 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-11-30 14:35:18 -0800 |
commit | 1bab4bba5457bd55fc1c27ddc4218b4b375c8251 (patch) | |
tree | 050b7961795d33cfc9e10d127dbdd5e1a3044509 | |
parent | 5e2f779cbf60997809130fde213736e1ea4f6f33 (diff) | |
parent | 528fb08732aa742edf56bc61cc8943c7f6d02977 (diff) | |
download | git-1bab4bba5457bd55fc1c27ddc4218b4b375c8251.tar.gz git-1bab4bba5457bd55fc1c27ddc4218b4b375c8251.tar.xz |
Merge branch 'ns/send-email-no-chain-reply-to'
-rwxr-xr-x | git-send-email.perl | 19 | ||||
-rwxr-xr-x | t/t9001-send-email.sh | 49 |
2 files changed, 66 insertions, 2 deletions
diff --git a/git-send-email.perl b/git-send-email.perl index 4f5da4ecf..6bd4bbc81 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -187,9 +187,11 @@ my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts); my ($validate, $confirm); my (@suppress_cc); +my $not_set_by_user = "true but not set by the user"; + my %config_bool_settings = ( "thread" => [\$thread, 1], - "chainreplyto" => [\$chain_reply_to, 1], + "chainreplyto" => [\$chain_reply_to, $not_set_by_user], "suppressfrom" => [\$suppress_from, undef], "signedoffbycc" => [\$signed_off_by_cc, undef], "signedoffcc" => [\$signed_off_by_cc, undef], # Deprecated @@ -214,6 +216,19 @@ my %config_settings = ( "from" => \$sender, ); +# Help users prepare for 1.7.0 +sub chain_reply_to { + if (defined $chain_reply_to && + $chain_reply_to eq $not_set_by_user) { + print STDERR + "In git 1.7.0, the default will be changed to --no-chain-reply-to\n" . + "Set sendemail.chainreplyto configuration variable to true if\n" . + "you want to keep --chain-reply-to as your default.\n"; + $chain_reply_to = 1; + } + return $chain_reply_to; +} + # Handle Uncouth Termination sub signal_handler { @@ -1157,7 +1172,7 @@ foreach my $t (@files) { # set up for the next message if ($thread && $message_was_sent && - ($chain_reply_to || !defined $reply_to || length($reply_to) == 0)) { + (chain_reply_to() || !defined $reply_to || length($reply_to) == 0)) { $reply_to = $message_id; if (length $references > 0) { $references .= "\n $message_id"; diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 84a7f03d4..798291240 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -769,4 +769,53 @@ test_expect_success 'threading but no chain-reply-to' ' grep "In-Reply-To: " stdout ' +test_expect_success 'warning with an implicit --chain-reply-to' ' + git send-email \ + --dry-run \ + --from="Example <nobody@example.com>" \ + --to=nobody@example.com \ + outdir/000?-*.patch 2>errors >out && + grep "no-chain-reply-to" errors +' + +test_expect_success 'no warning with an explicit --chain-reply-to' ' + git send-email \ + --dry-run \ + --from="Example <nobody@example.com>" \ + --to=nobody@example.com \ + --chain-reply-to \ + outdir/000?-*.patch 2>errors >out && + ! grep "no-chain-reply-to" errors +' + +test_expect_success 'no warning with an explicit --no-chain-reply-to' ' + git send-email \ + --dry-run \ + --from="Example <nobody@example.com>" \ + --to=nobody@example.com \ + --no-chain-reply-to \ + outdir/000?-*.patch 2>errors >out && + ! grep "no-chain-reply-to" errors +' + +test_expect_success 'no warning with sendemail.chainreplyto = false' ' + git config sendemail.chainreplyto false && + git send-email \ + --dry-run \ + --from="Example <nobody@example.com>" \ + --to=nobody@example.com \ + outdir/000?-*.patch 2>errors >out && + ! grep "no-chain-reply-to" errors +' + +test_expect_success 'no warning with sendemail.chainreplyto = true' ' + git config sendemail.chainreplyto true && + git send-email \ + --dry-run \ + --from="Example <nobody@example.com>" \ + --to=nobody@example.com \ + outdir/000?-*.patch 2>errors >out && + ! grep "no-chain-reply-to" errors +' + test_done |