Skip to content

Commit f515c90

Browse files
mstsirkingitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d8779e1 commit f515c90

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

Documentation/git-send-email.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,18 @@ Automating
248248
cc list. Default is the value of 'sendemail.signedoffbycc' configuration
249249
value; if that is unspecified, default to --signed-off-by-cc.
250250

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+
251263
--suppress-cc=<category>::
252264
Specify an additional category of recipients to suppress the
253265
auto-cc of:

git-send-email.perl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ sub usage {
8080
--to-cmd <str> * Email To: via `<str> \$patch_path`
8181
--cc-cmd <str> * Email Cc: via `<str> \$patch_path`
8282
--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.
8385
--[no-]signed-off-by-cc * Send to Signed-off-by: addresses. Default on.
8486
--[no-]suppress-from * Send to self. Default off.
8587
--[no-]chain-reply-to * Chain In-Reply-To: fields. Default off.
@@ -195,6 +197,7 @@ sub do_edit {
195197

196198
# Variables with corresponding config settings
197199
my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc);
200+
my ($cover_cc, $cover_to);
198201
my ($to_cmd, $cc_cmd);
199202
my ($smtp_server, $smtp_server_port, @smtp_server_options);
200203
my ($smtp_authuser, $smtp_encryption, $smtp_ssl_cert_path);
@@ -211,6 +214,8 @@ sub do_edit {
211214
"chainreplyto" => [\$chain_reply_to, 0],
212215
"suppressfrom" => [\$suppress_from, undef],
213216
"signedoffbycc" => [\$signed_off_by_cc, undef],
217+
"cccover" => [\$cover_cc, undef],
218+
"tocover" => [\$cover_to, undef],
214219
"signedoffcc" => [\$signed_off_by_cc, undef], # Deprecated
215220
"validate" => [\$validate, 1],
216221
"multiedit" => [\$multiedit, undef],
@@ -302,6 +307,8 @@ sub signal_handler {
302307
"suppress-from!" => \$suppress_from,
303308
"suppress-cc=s" => \@suppress_cc,
304309
"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,
305312
"confirm=s" => \$confirm,
306313
"dry-run" => \$dry_run,
307314
"envelope-sender=s" => \$envelope_sender,
@@ -1469,6 +1476,15 @@ sub send_message {
14691476
@to = (@initial_to, @to);
14701477
@cc = (@initial_cc, @cc);
14711478

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+
14721488
my $message_was_sent = send_message();
14731489

14741490
# set up for the next message

0 commit comments

Comments
 (0)