From: Junio C Hamano Date: Mon, 30 Nov 2009 22:42:50 +0000 (-0800) Subject: Merge branch 'fc/send-email-envelope' X-Git-Tag: v1.6.6-rc1~15 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/0c7cc135c52b7c573710f247fc55ea1bf677f1bc?hp=-c Merge branch 'fc/send-email-envelope' --- 0c7cc135c52b7c573710f247fc55ea1bf677f1bc diff --combined Documentation/git-send-email.txt index c85d7f4385,118c902e7a..8c482f40b9 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@@ -60,8 -60,8 +60,8 @@@ The --bcc option must be repeated for e The --cc option must be repeated for each user you want on the cc list. --compose:: - Use $GIT_EDITOR, core.editor, $VISUAL, or $EDITOR to edit an - introductory message for the patch series. + Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1]) + to edit an introductory message for the patch series. + When '--compose' is used, git send-email will use the From, Subject, and In-Reply-To headers specified in the message. If the body of the message @@@ -108,9 -108,10 +108,10 @@@ Sendin --envelope-sender=
:: Specify the envelope sender used to send the emails. This is useful if your default address is not the address that is - subscribed to a list. If you use the sendmail binary, you must have - suitable privileges for the -f parameter. Default is the value of - the 'sendemail.envelopesender' configuration variable; if that is + subscribed to a list. In order to use the 'From' address, set the + value to "auto". If you use the sendmail binary, you must have + suitable privileges for the -f parameter. Default is the value of the + 'sendemail.envelopesender' configuration variable; if that is unspecified, choosing the envelope sender is left to your MTA. --smtp-encryption=:: diff --combined git-send-email.perl index 6bd4bbc81a,9f44e2964a..319b535671 --- a/git-send-email.perl +++ b/git-send-email.perl @@@ -162,8 -162,7 +162,8 @@@ my $compose_filename # Handle interactive edition of files. my $multiedit; -my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi"; +my $editor = Git::command_oneline('var', 'GIT_EDITOR'); + sub do_edit { if (defined($multiedit) && !$multiedit) { map { @@@ -187,11 -186,9 +187,11 @@@ my ($identity, $aliasfiletype, @alias_f 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 @@@ -216,19 -213,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 { @@@ -851,7 -835,7 +851,7 @@@ sub send_messag $gitversion = Git::version(); } - my $cc = join(", ", unique_email_list(@cc)); + my $cc = join(",\n\t", unique_email_list(@cc)); my $ccline = ""; if ($cc ne '') { $ccline = "\nCc: $cc"; @@@ -877,7 -861,9 +877,9 @@@ X-Mailer: git-send-email $gitversio my @sendmail_parameters = ('-i', @recipients); my $raw_from = $sanitized_sender; - $raw_from = $envelope_sender if (defined $envelope_sender); + if (defined $envelope_sender && $envelope_sender ne "auto") { + $raw_from = $envelope_sender; + } $raw_from = extract_valid_address($raw_from); unshift (@sendmail_parameters, '-f', $raw_from) if(defined $envelope_sender); @@@ -992,9 -978,7 +994,9 @@@ if ($smtp_server !~ m#^/#) { print "Server: $smtp_server\n"; print "MAIL FROM:<$raw_from>\n"; - print "RCPT TO:".join(',',(map { "<$_>" } @recipients))."\n"; + foreach my $entry (@recipients) { + print "RCPT TO:<$entry>\n"; + } } else { print "Sendmail: $smtp_server ".join(' ',@sendmail_parameters)."\n"; } @@@ -1172,7 -1156,7 +1174,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 --combined t/t9001-send-email.sh index 798291240a,c23ea0f3c5..fb51ab3dbe --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@@ -95,6 -95,40 +95,40 @@@ test_expect_success 'Verify commandline' \ 'test_cmp expected commandline1' + test_expect_success 'Send patches with --envelope-sender' ' + clean_fake_sendmail && + git send-email --envelope-sender="Patch Contributer " --suppress-cc=sob --from="Example " --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors + ' + + cat >expected <<\EOF + !patch@example.com! + !-i! + !nobody@example.com! + !author@example.com! + !one@example.com! + !two@example.com! + EOF + test_expect_success \ + 'Verify commandline' \ + 'test_cmp expected commandline1' + + test_expect_success 'Send patches with --envelope-sender=auto' ' + clean_fake_sendmail && + git send-email --envelope-sender=auto --suppress-cc=sob --from="Example " --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors + ' + + cat >expected <<\EOF + !nobody@example.com! + !-i! + !nobody@example.com! + !author@example.com! + !one@example.com! + !two@example.com! + EOF + test_expect_success \ + 'Verify commandline' \ + 'test_cmp expected commandline1' + cat >expected-show-all-headers <<\EOF 0001-Second.patch (mbox) Adding cc: A from line 'From: A ' @@@ -103,18 -137,10 +137,18 @@@ Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: cc@example.com, A , One , two@example.com +Cc: cc@example.com, + A , + One , + two@example.com Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@@ -172,7 -198,7 +206,7 @@@ test_expect_success 'cccmd works' --smtp-server="$(pwd)/fake.sendmail" \ cccmd.patch \ && - grep ^Cc:.*cccmd@example.com msgtxt1 + grep "^ cccmd@example.com" msgtxt1 ' z8=zzzzzzzz @@@ -286,17 -312,10 +320,17 @@@ cat >expected-suppress-sob <<\EO Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: cc@example.com, A , One , two@example.com +Cc: cc@example.com, + A , + One , + two@example.com Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@@ -333,15 -352,10 +367,15 @@@ cat >expected-suppress-sob <<\EO Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: A , One , two@example.com +Cc: A , + One , + two@example.com Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@@ -364,17 -378,10 +398,17 @@@ cat >expected-suppress-cccmd <<\EO Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: A , One , two@example.com, C O Mitter +Cc: A , + One , + two@example.com, + C O Mitter Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@@ -419,17 -426,10 +453,17 @@@ cat >expected-suppress-body <<\EO Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: A , One , two@example.com, cc-cmd@example.com +Cc: A , + One , + two@example.com, + cc-cmd@example.com Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@@ -450,15 -450,10 +484,15 @@@ cat >expected-suppress-body-cccmd <<\EO Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: A , One , two@example.com +Cc: A , + One , + two@example.com Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@@ -479,15 -474,10 +513,15 @@@ cat >expected-suppress-sob <<\EO Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: A , One , two@example.com +Cc: A , + One , + two@example.com Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@@ -510,17 -500,10 +544,17 @@@ cat >expected-suppress-bodycc <<\EO Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: A , One , two@example.com, C O Mitter +Cc: A , + One , + two@example.com, + C O Mitter Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@@ -540,13 -523,10 +574,13 @@@ cat >expected-suppress-cc <<\EO Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,, +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: A , C O Mitter +Cc: A , + C O Mitter Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@@ -659,7 -639,7 +693,7 @@@ test_expect_success 'utf8 Cc is rfc204 --to=nobody@example.com \ --smtp-server="$(pwd)/fake.sendmail" \ outdir/*.patch && - grep "^Cc:" msgtxt1 | + grep "^ " msgtxt1 | grep "=?UTF-8?q?=C3=A0=C3=A9=C3=AC=C3=B6=C3=BA?= " ' @@@ -769,53 -749,4 +803,53 @@@ test_expect_success 'threading but no c grep "In-Reply-To: " stdout ' +test_expect_success 'warning with an implicit --chain-reply-to' ' + git send-email \ + --dry-run \ + --from="Example " \ + --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 " \ + --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 " \ + --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 " \ + --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 " \ + --to=nobody@example.com \ + outdir/000?-*.patch 2>errors >out && + ! grep "no-chain-reply-to" errors +' + test_done