* [PATCH v4 1/2] git-send-email: two new options: to-cover, cc-cover
@ 2014-04-29 5:41 Michael S. Tsirkin
2014-04-29 5:41 ` [PATCH v4 2/2] test/send-email: to-cover, cc-cover tests Michael S. Tsirkin
0 siblings, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2014-04-29 5:41 UTC (permalink / raw)
To: git
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>
---
Documentation/git-send-email.txt | 12 ++++++++++++
git-send-email.perl | 16 ++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index f0e57a5..b983053 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -248,6 +248,18 @@ Automating
cc list. Default is the value of 'sendemail.signedoffbycc' configuration
value; if that is unspecified, default to --signed-off-by-cc.
+--[no-]cc-cover::
+ If this is set, emails found in Cc: headers in the first patch of
+ the series (typically the cover letter) are added to the cc list
+ for each email set. Default is the value of 'sendemail.cccover'
+ configuration value; if that is unspecified, default to --no-cc-cover.
+
+--[no-]to-cover::
+ If this is set, emails found in To: headers in the first patch of
+ the series (typically the cover letter) are added to the to list
+ for each email set. Default is the value of 'sendemail.tocover'
+ configuration value; if that is unspecified, default to --no-to-cover.
+
--suppress-cc=<category>::
Specify an additional category of recipients to suppress the
auto-cc of:
diff --git a/git-send-email.perl b/git-send-email.perl
index 4c138a2..0084cf4 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -80,6 +80,8 @@ git send-email [options] <file | directory | rev-list options >
--to-cmd <str> * Email To: via `<str> \$patch_path`
--cc-cmd <str> * Email Cc: via `<str> \$patch_path`
--suppress-cc <str> * author, self, sob, cc, cccmd, body, bodycc, all.
+ --[no-]cc-cover * Email Cc: addresses in the cover letter.
+ --[no-]to-cover * Email To: addresses in the cover letter.
--[no-]signed-off-by-cc * Send to Signed-off-by: addresses. Default on.
--[no-]suppress-from * Send to self. Default off.
--[no-]chain-reply-to * Chain In-Reply-To: fields. Default off.
@@ -195,6 +197,7 @@ sub do_edit {
# Variables with corresponding config settings
my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc);
+my ($cover_cc, $cover_to);
my ($to_cmd, $cc_cmd);
my ($smtp_server, $smtp_server_port, @smtp_server_options);
my ($smtp_authuser, $smtp_encryption, $smtp_ssl_cert_path);
@@ -211,6 +214,8 @@ my %config_bool_settings = (
"chainreplyto" => [\$chain_reply_to, 0],
"suppressfrom" => [\$suppress_from, undef],
"signedoffbycc" => [\$signed_off_by_cc, undef],
+ "cccover" => [\$cover_cc, undef],
+ "tocover" => [\$cover_to, undef],
"signedoffcc" => [\$signed_off_by_cc, undef], # Deprecated
"validate" => [\$validate, 1],
"multiedit" => [\$multiedit, undef],
@@ -302,6 +307,8 @@ my $rc = GetOptions("h" => \$help,
"suppress-from!" => \$suppress_from,
"suppress-cc=s" => \@suppress_cc,
"signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
+ "cc-cover|cc-cover!" => \$cover_cc,
+ "to-cover|to-cover!" => \$cover_to,
"confirm=s" => \$confirm,
"dry-run" => \$dry_run,
"envelope-sender=s" => \$envelope_sender,
@@ -1469,6 +1476,15 @@ foreach my $t (@files) {
@to = (@initial_to, @to);
@cc = (@initial_cc, @cc);
+ if ($message_num == 1) {
+ if (defined $cover_cc and $cover_cc) {
+ @initial_cc = @cc;
+ }
+ if (defined $cover_to and $cover_to) {
+ @initial_to = @to;
+ }
+ }
+
my $message_was_sent = send_message();
# set up for the next message
--
MST
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v4 2/2] test/send-email: to-cover, cc-cover tests
2014-04-29 5:41 [PATCH v4 1/2] git-send-email: two new options: to-cover, cc-cover Michael S. Tsirkin
@ 2014-04-29 5:41 ` Michael S. Tsirkin
2014-04-29 19:01 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2014-04-29 5:41 UTC (permalink / raw)
To: git
Add tests for the new feature.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
t/t9001-send-email.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 1ecdacb..97cc094 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1334,6 +1334,51 @@ test_expect_success $PREREQ '--force sends cover letter template anyway' '
test -n "$(ls msgtxt*)"
'
+test_cover_addresses () {
+ header="$1"
+ shift
+ clean_fake_sendmail &&
+ rm -fr outdir &&
+ git format-patch --cover-letter -2 -o outdir &&
+ cover=`echo outdir/0000-*.patch` &&
+ mv $cover cover-to-edit.patch &&
+ sed "s/^From:/$header: extra@address.com\nFrom:/" cover-to-edit.patch > $cover &&
+ git send-email \
+ --force \
+ --from="Example <nobody@example.com>" \
+ --no-to --no-cc \
+ "$@" \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ outdir/0000-*.patch \
+ outdir/0001-*.patch \
+ outdir/0002-*.patch \
+ 2>errors >out &&
+ grep "^$header: extra@address.com" msgtxt1 > to1 &&
+ grep "^$header: extra@address.com" msgtxt2 > to2 &&
+ grep "^$header: extra@address.com" msgtxt3 > to3 &&
+ test_line_count = 1 to1 &&
+ test_line_count = 1 to2 &&
+ test_line_count = 1 to3
+}
+
+test_expect_success $PREREQ 'to-cover adds To to all mail' '
+ test_cover_addresses "To" --to-cover
+'
+
+test_expect_success $PREREQ 'cc-cover adds Cc to all mail' '
+ test_cover_addresses "Cc" --cc-cover
+'
+
+test_expect_success $PREREQ 'tocover adds To to all mail' '
+ test_config sendemail.tocover true &&
+ test_cover_addresses "To"
+'
+
+test_expect_success $PREREQ 'cccover adds Cc to all mail' '
+ test_config sendemail.cccover true &&
+ test_cover_addresses "Cc"
+'
+
test_expect_success $PREREQ 'sendemail.aliasfiletype=mailrc' '
clean_fake_sendmail &&
echo "alias sbd somebody@example.org" >.mailrc &&
--
MST
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v4 2/2] test/send-email: to-cover, cc-cover tests
2014-04-29 5:41 ` [PATCH v4 2/2] test/send-email: to-cover, cc-cover tests Michael S. Tsirkin
@ 2014-04-29 19:01 ` Junio C Hamano
2014-04-29 20:05 ` Michael S. Tsirkin
0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2014-04-29 19:01 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: git
"Michael S. Tsirkin" <mst@redhat.com> writes:
> Add tests for the new feature.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> t/t9001-send-email.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 45 insertions(+)
>
> diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
> index 1ecdacb..97cc094 100755
> --- a/t/t9001-send-email.sh
> +++ b/t/t9001-send-email.sh
> @@ -1334,6 +1334,51 @@ test_expect_success $PREREQ '--force sends cover letter template anyway' '
> test -n "$(ls msgtxt*)"
> '
>
> +test_cover_addresses () {
> + header="$1"
> + shift
> + clean_fake_sendmail &&
> + rm -fr outdir &&
> + git format-patch --cover-letter -2 -o outdir &&
> + cover=`echo outdir/0000-*.patch` &&
> + mv $cover cover-to-edit.patch &&
> + sed "s/^From:/$header: extra@address.com\nFrom:/" cover-to-edit.patch > $cover &&
Please do the redirection like this:
sed "s/^From:/$header: extra@address.com\nFrom:/" cover-to-edit.patch >"$cover" &&
in your later patches (I'll tweak this patch myself, so no need to
resend). We know >$cover should be the same as >"$cover", but it
was reported that some version of bash does not know it and
complains instead (see Documentation/CodingGuidelines).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v4 2/2] test/send-email: to-cover, cc-cover tests
2014-04-29 19:01 ` Junio C Hamano
@ 2014-04-29 20:05 ` Michael S. Tsirkin
0 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2014-04-29 20:05 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Tue, Apr 29, 2014 at 12:01:10PM -0700, Junio C Hamano wrote:
> "Michael S. Tsirkin" <mst@redhat.com> writes:
>
> > Add tests for the new feature.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > t/t9001-send-email.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 45 insertions(+)
> >
> > diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
> > index 1ecdacb..97cc094 100755
> > --- a/t/t9001-send-email.sh
> > +++ b/t/t9001-send-email.sh
> > @@ -1334,6 +1334,51 @@ test_expect_success $PREREQ '--force sends cover letter template anyway' '
> > test -n "$(ls msgtxt*)"
> > '
> >
> > +test_cover_addresses () {
> > + header="$1"
> > + shift
> > + clean_fake_sendmail &&
> > + rm -fr outdir &&
> > + git format-patch --cover-letter -2 -o outdir &&
> > + cover=`echo outdir/0000-*.patch` &&
> > + mv $cover cover-to-edit.patch &&
> > + sed "s/^From:/$header: extra@address.com\nFrom:/" cover-to-edit.patch > $cover &&
>
> Please do the redirection like this:
>
> sed "s/^From:/$header: extra@address.com\nFrom:/" cover-to-edit.patch >"$cover" &&
>
> in your later patches (I'll tweak this patch myself, so no need to
> resend). We know >$cover should be the same as >"$cover", but it
> was reported that some version of bash does not know it and
> complains instead (see Documentation/CodingGuidelines).
I'll try to remember this, thanks.
--
MST
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-29 19:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-29 5:41 [PATCH v4 1/2] git-send-email: two new options: to-cover, cc-cover Michael S. Tsirkin
2014-04-29 5:41 ` [PATCH v4 2/2] test/send-email: to-cover, cc-cover tests Michael S. Tsirkin
2014-04-29 19:01 ` Junio C Hamano
2014-04-29 20:05 ` Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).