{"thread":{"id":"36535","subject":"[PATCH v4 1/2] git-send-email: two new options: to-cover, cc-cover","startedAt":"2014-04-29T05:41:16Z","lastAt":"2014-04-29T20:05:10Z","messageCount":4,"participants":["Michael S. Tsirkin","Junio C Hamano"],"isPatch":true,"patchVersion":4,"patchTotal":2},"messages":[{"id":"240116","messageId":"1398750059-11955-1-git-send-email-mst@redhat.com","threadId":"36535","inReplyTo":null,"subject":"[PATCH v4 1/2] git-send-email: two new options: to-cover, cc-cover","fromName":"Michael S. Tsirkin","fromEmail":"mst@redhat.com","sentAt":"2014-04-29T05:41:16Z","receivedAt":"2014-04-29T05:41:16Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Allow extracting To/Cc addresses from the first patch\n(typically the cover letter), and use them as To/Cc addresses of the\nremainder of the series.\n\nSigned-off-by: Michael S. Tsirkin <mst@redhat.com>\n---\n Documentation/git-send-email.txt | 12 ++++++++++++\n git-send-email.perl              | 16 ++++++++++++++++\n 2 files changed, 28 insertions(+)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex f0e57a5..b983053 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -248,6 +248,18 @@ Automating\n \tcc list. Default is the value of 'sendemail.signedoffbycc' configuration\n \tvalue; if that is unspecified, default to --signed-off-by-cc.\n \n+--[no-]cc-cover::\n+\tIf this is set, emails found in Cc: headers in the first patch of\n+\tthe series (typically the cover letter) are added to the cc list\n+\tfor each email set. Default is the value of 'sendemail.cccover'\n+\tconfiguration value; if that is unspecified, default to --no-cc-cover.\n+\n+--[no-]to-cover::\n+\tIf this is set, emails found in To: headers in the first patch of\n+\tthe series (typically the cover letter) are added to the to list\n+\tfor each email set. Default is the value of 'sendemail.tocover'\n+\tconfiguration value; if that is unspecified, default to --no-to-cover.\n+\n --suppress-cc=<category>::\n \tSpecify an additional category of recipients to suppress the\n \tauto-cc of:\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 4c138a2..0084cf4 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -80,6 +80,8 @@ git send-email [options] <file | directory | rev-list options >\n     --to-cmd                <str>  * Email To: via `<str> \\$patch_path`\n     --cc-cmd                <str>  * Email Cc: via `<str> \\$patch_path`\n     --suppress-cc           <str>  * author, self, sob, cc, cccmd, body, bodycc, all.\n+    --[no-]cc-cover                * Email Cc: addresses in the cover letter.\n+    --[no-]to-cover                * Email To: addresses in the cover letter.\n     --[no-]signed-off-by-cc        * Send to Signed-off-by: addresses. Default on.\n     --[no-]suppress-from           * Send to self. Default off.\n     --[no-]chain-reply-to          * Chain In-Reply-To: fields. Default off.\n@@ -195,6 +197,7 @@ sub do_edit {\n \n # Variables with corresponding config settings\n my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc);\n+my ($cover_cc, $cover_to);\n my ($to_cmd, $cc_cmd);\n my ($smtp_server, $smtp_server_port, @smtp_server_options);\n my ($smtp_authuser, $smtp_encryption, $smtp_ssl_cert_path);\n@@ -211,6 +214,8 @@ my %config_bool_settings = (\n     \"chainreplyto\" => [\\$chain_reply_to, 0],\n     \"suppressfrom\" => [\\$suppress_from, undef],\n     \"signedoffbycc\" => [\\$signed_off_by_cc, undef],\n+    \"cccover\" => [\\$cover_cc, undef],\n+    \"tocover\" => [\\$cover_to, undef],\n     \"signedoffcc\" => [\\$signed_off_by_cc, undef],      # Deprecated\n     \"validate\" => [\\$validate, 1],\n     \"multiedit\" => [\\$multiedit, undef],\n@@ -302,6 +307,8 @@ my $rc = GetOptions(\"h\" => \\$help,\n \t\t    \"suppress-from!\" => \\$suppress_from,\n \t\t    \"suppress-cc=s\" => \\@suppress_cc,\n \t\t    \"signed-off-cc|signed-off-by-cc!\" => \\$signed_off_by_cc,\n+\t\t    \"cc-cover|cc-cover!\" => \\$cover_cc,\n+\t\t    \"to-cover|to-cover!\" => \\$cover_to,\n \t\t    \"confirm=s\" => \\$confirm,\n \t\t    \"dry-run\" => \\$dry_run,\n \t\t    \"envelope-sender=s\" => \\$envelope_sender,\n@@ -1469,6 +1476,15 @@ foreach my $t (@files) {\n \t@to = (@initial_to, @to);\n \t@cc = (@initial_cc, @cc);\n \n+\tif ($message_num == 1) {\n+\t\tif (defined $cover_cc and $cover_cc) {\n+\t\t\t@initial_cc = @cc;\n+\t\t}\n+\t\tif (defined $cover_to and $cover_to) {\n+\t\t\t@initial_to = @to;\n+\t\t}\n+\t}\n+\n \tmy $message_was_sent = send_message();\n \n \t# set up for the next message\n-- \nMST\n"},{"id":"240118","messageId":"1398750059-11955-2-git-send-email-mst@redhat.com","threadId":"36535","inReplyTo":"1398750059-11955-1-git-send-email-mst@redhat.com","subject":"[PATCH v4 2/2] test/send-email: to-cover, cc-cover tests","fromName":"Michael S. Tsirkin","fromEmail":"mst@redhat.com","sentAt":"2014-04-29T05:41:18Z","receivedAt":"2014-04-29T05:41:18Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Add tests for the new feature.\n\nSigned-off-by: Michael S. Tsirkin <mst@redhat.com>\n---\n t/t9001-send-email.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 45 insertions(+)\n\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 1ecdacb..97cc094 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -1334,6 +1334,51 @@ test_expect_success $PREREQ '--force sends cover letter template anyway' '\n \ttest -n \"$(ls msgtxt*)\"\n '\n \n+test_cover_addresses () {\n+\theader=\"$1\"\n+\tshift\n+\tclean_fake_sendmail &&\n+\trm -fr outdir &&\n+\tgit format-patch --cover-letter -2 -o outdir &&\n+\tcover=`echo outdir/0000-*.patch` &&\n+\tmv $cover cover-to-edit.patch &&\n+\tsed \"s/^From:/$header: extra@address.com\\nFrom:/\" cover-to-edit.patch > $cover &&\n+\tgit send-email \\\n+\t  --force \\\n+\t  --from=\"Example <nobody@example.com>\" \\\n+\t  --no-to --no-cc \\\n+\t  \"$@\" \\\n+\t  --smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t  outdir/0000-*.patch \\\n+\t  outdir/0001-*.patch \\\n+\t  outdir/0002-*.patch \\\n+\t  2>errors >out &&\n+\tgrep \"^$header: extra@address.com\" msgtxt1 > to1 &&\n+\tgrep \"^$header: extra@address.com\" msgtxt2 > to2 &&\n+\tgrep \"^$header: extra@address.com\" msgtxt3 > to3 &&\n+\ttest_line_count = 1 to1 &&\n+\ttest_line_count = 1 to2 &&\n+\ttest_line_count = 1 to3\n+}\n+\n+test_expect_success $PREREQ 'to-cover adds To to all mail' '\n+\ttest_cover_addresses \"To\" --to-cover\n+'\n+\n+test_expect_success $PREREQ 'cc-cover adds Cc to all mail' '\n+\ttest_cover_addresses \"Cc\" --cc-cover\n+'\n+\n+test_expect_success $PREREQ 'tocover adds To to all mail' '\n+\ttest_config sendemail.tocover true &&\n+\ttest_cover_addresses \"To\"\n+'\n+\n+test_expect_success $PREREQ 'cccover adds Cc to all mail' '\n+\ttest_config sendemail.cccover true &&\n+\ttest_cover_addresses \"Cc\"\n+'\n+\n test_expect_success $PREREQ 'sendemail.aliasfiletype=mailrc' '\n \tclean_fake_sendmail &&\n \techo \"alias sbd  somebody@example.org\" >.mailrc &&\n-- \nMST\n"},{"id":"240196","messageId":"xmqqppk0j6yx.fsf@gitster.dls.corp.google.com","threadId":"36535","inReplyTo":"1398750059-11955-2-git-send-email-mst@redhat.com","subject":"Re: [PATCH v4 2/2] test/send-email: to-cover, cc-cover tests","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-04-29T19:01:10Z","receivedAt":"2014-04-29T19:01:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@redhat.com> writes:\n\n> Add tests for the new feature.\n>\n> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>\n> ---\n>  t/t9001-send-email.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 45 insertions(+)\n>\n> diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\n> index 1ecdacb..97cc094 100755\n> --- a/t/t9001-send-email.sh\n> +++ b/t/t9001-send-email.sh\n> @@ -1334,6 +1334,51 @@ test_expect_success $PREREQ '--force sends cover letter template anyway' '\n>  \ttest -n \"$(ls msgtxt*)\"\n>  '\n>  \n> +test_cover_addresses () {\n> +\theader=\"$1\"\n> +\tshift\n> +\tclean_fake_sendmail &&\n> +\trm -fr outdir &&\n> +\tgit format-patch --cover-letter -2 -o outdir &&\n> +\tcover=`echo outdir/0000-*.patch` &&\n> +\tmv $cover cover-to-edit.patch &&\n> +\tsed \"s/^From:/$header: extra@address.com\\nFrom:/\" cover-to-edit.patch > $cover &&\n\nPlease do the redirection like this:\n\n\tsed \"s/^From:/$header: extra@address.com\\nFrom:/\" cover-to-edit.patch >\"$cover\" &&\n\nin your later patches (I'll tweak this patch myself, so no need to\nresend).  We know >$cover should be the same as >\"$cover\", but it\nwas reported that some version of bash does not know it and\ncomplains instead (see Documentation/CodingGuidelines).\n"},{"id":"240198","messageId":"20140429200510.GA20753@redhat.com","threadId":"36535","inReplyTo":"xmqqppk0j6yx.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v4 2/2] test/send-email: to-cover, cc-cover tests","fromName":"Michael S. Tsirkin","fromEmail":"mst@redhat.com","sentAt":"2014-04-29T20:05:10Z","receivedAt":"2014-04-29T20:05:10Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"On Tue, Apr 29, 2014 at 12:01:10PM -0700, Junio C Hamano wrote:\n> \"Michael S. Tsirkin\" <mst@redhat.com> writes:\n> \n> > Add tests for the new feature.\n> >\n> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>\n> > ---\n> >  t/t9001-send-email.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++\n> >  1 file changed, 45 insertions(+)\n> >\n> > diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\n> > index 1ecdacb..97cc094 100755\n> > --- a/t/t9001-send-email.sh\n> > +++ b/t/t9001-send-email.sh\n> > @@ -1334,6 +1334,51 @@ test_expect_success $PREREQ '--force sends cover letter template anyway' '\n> >  \ttest -n \"$(ls msgtxt*)\"\n> >  '\n> >  \n> > +test_cover_addresses () {\n> > +\theader=\"$1\"\n> > +\tshift\n> > +\tclean_fake_sendmail &&\n> > +\trm -fr outdir &&\n> > +\tgit format-patch --cover-letter -2 -o outdir &&\n> > +\tcover=`echo outdir/0000-*.patch` &&\n> > +\tmv $cover cover-to-edit.patch &&\n> > +\tsed \"s/^From:/$header: extra@address.com\\nFrom:/\" cover-to-edit.patch > $cover &&\n> \n> Please do the redirection like this:\n> \n> \tsed \"s/^From:/$header: extra@address.com\\nFrom:/\" cover-to-edit.patch >\"$cover\" &&\n> \n> in your later patches (I'll tweak this patch myself, so no need to\n> resend).  We know >$cover should be the same as >\"$cover\", but it\n> was reported that some version of bash does not know it and\n> complains instead (see Documentation/CodingGuidelines).\n\nI'll try to remember this, thanks.\n\n-- \nMST\n"}]}