git-send-email: two new options: to-cover, cc-cover

Allow extracting To/Cc addresses from the first patch (typically the cover letter), and use them as To/Cc addresses of the remainder of the series. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael S. Tsirkin committed Apr 29, 2014 at 08:41 UTC f515c904fb4d1b95bb8b94cb00fb6b5768cf0ed4
2 files changed +28
Documentation/git-send-email.txt
+12
@@ -248,6 +248,18 @@ Automating
248 cc list. Default is the value of 'sendemail.signedoffbycc' configuration
249 value; if that is unspecified, default to --signed-off-by-cc.
250
251 +--[no-]cc-cover::
252 + If this is set, emails found in Cc: headers in the first patch of
253 + the series (typically the cover letter) are added to the cc list
254 + for each email set. Default is the value of 'sendemail.cccover'
255 + configuration value; if that is unspecified, default to --no-cc-cover.
256 +
257 +--[no-]to-cover::
258 + If this is set, emails found in To: headers in the first patch of
259 + the series (typically the cover letter) are added to the to list
260 + for each email set. Default is the value of 'sendemail.tocover'
261 + configuration value; if that is unspecified, default to --no-to-cover.
262 +
263 --suppress-cc=<category>::
264 Specify an additional category of recipients to suppress the
265 auto-cc of:
git-send-email.perl
+16
@@ -80,6 +80,8 @@ git send-email [options] <file | directory | rev-list options >
80 --to-cmd <str> * Email To: via `<str> \$patch_path`
81 --cc-cmd <str> * Email Cc: via `<str> \$patch_path`
82 --suppress-cc <str> * author, self, sob, cc, cccmd, body, bodycc, all.
83 + --[no-]cc-cover * Email Cc: addresses in the cover letter.
84 + --[no-]to-cover * Email To: addresses in the cover letter.
85 --[no-]signed-off-by-cc * Send to Signed-off-by: addresses. Default on.
86 --[no-]suppress-from * Send to self. Default off.
87 --[no-]chain-reply-to * Chain In-Reply-To: fields. Default off.
@@ -195,6 +197,7 @@ sub do_edit {
197
198 # Variables with corresponding config settings
199 my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc);
200 +my ($cover_cc, $cover_to);
201 my ($to_cmd, $cc_cmd);
202 my ($smtp_server, $smtp_server_port, @smtp_server_options);
203 my ($smtp_authuser, $smtp_encryption, $smtp_ssl_cert_path);
@@ -211,6 +214,8 @@ my %config_bool_settings = (
214 "chainreplyto" => [\$chain_reply_to, 0],
215 "suppressfrom" => [\$suppress_from, undef],
216 "signedoffbycc" => [\$signed_off_by_cc, undef],
217 + "cccover" => [\$cover_cc, undef],
218 + "tocover" => [\$cover_to, undef],
219 "signedoffcc" => [\$signed_off_by_cc, undef], # Deprecated
220 "validate" => [\$validate, 1],
221 "multiedit" => [\$multiedit, undef],
@@ -302,6 +307,8 @@ my $rc = GetOptions("h" => \$help,
307 "suppress-from!" => \$suppress_from,
308 "suppress-cc=s" => \@suppress_cc,
309 "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
310 + "cc-cover|cc-cover!" => \$cover_cc,
311 + "to-cover|to-cover!" => \$cover_to,
312 "confirm=s" => \$confirm,
313 "dry-run" => \$dry_run,
314 "envelope-sender=s" => \$envelope_sender,
@@ -1469,6 +1476,15 @@ foreach my $t (@files) {
1476 @to = (@initial_to, @to);
1477 @cc = (@initial_cc, @cc);
1478
1479 + if ($message_num == 1) {
1480 + if (defined $cover_cc and $cover_cc) {
1481 + @initial_cc = @cc;
1482 + }
1483 + if (defined $cover_to and $cover_to) {
1484 + @initial_to = @to;
1485 + }
1486 + }
1487 +
1488 my $message_was_sent = send_message();
1489
1490 # set up for the next message