{"thread":{"id":"36345","subject":"[PATCH v2 1/2] git-send-email: two new options: to-cover, cc-cover","startedAt":"2014-04-03T18:14:08Z","lastAt":"2014-04-27T18:36:43Z","messageCount":6,"participants":["Michael S. Tsirkin","Junio C Hamano","Eric Sunshine"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"238357","messageId":"1396548814-27278-1-git-send-email-mst@redhat.com","threadId":"36345","inReplyTo":null,"subject":"[PATCH v2 1/2] git-send-email: two new options: to-cover, cc-cover","fromName":"Michael S. Tsirkin","fromEmail":"mst@redhat.com","sentAt":"2014-04-03T18:14:08Z","receivedAt":"2014-04-03T18:14:08Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Allow extracting To/Cc addresses from cover letter.\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..1733664 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 cover letter are\n+\tadded to the cc list for each email set. Default is the value of\n+\t'sendemail.cccover' configuration value; if that is unspecified,\n+\tdefault to --no-cc-cover.\n+\n+--[no-]to-cover::\n+\tIf this is set, emails found in To: headers in the cover letter are\n+\tadded to the to list for each email set. Default is the value of\n+\t'sendemail.tocover' configuration value; if that is unspecified,\n+\tdefault 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 8bbfb84..11d9a46 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@@ -1468,6 +1475,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":"238358","messageId":"1396548814-27278-2-git-send-email-mst@redhat.com","threadId":"36345","inReplyTo":"1396548814-27278-1-git-send-email-mst@redhat.com","subject":"[PATCH v2 2/2] test/send-email: add to-cover test","fromName":"Michael S. Tsirkin","fromEmail":"mst@redhat.com","sentAt":"2014-04-03T18:14:11Z","receivedAt":"2014-04-03T18:14:11Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Does it work? I am not sure.\n\nSigned-off-by: Michael S. Tsirkin <mst@redhat.com>\n---\n t/t9001-send-email.sh | 16 ++++++++++++++++\n 1 file changed, 16 insertions(+)\n\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 3119c8c..3b17884 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -1334,6 +1334,22 @@ test_expect_success $PREREQ '--force sends cover letter template anyway' '\n \ttest -n \"$(ls msgtxt*)\"\n '\n \n+test_expect_success $PREREQ 'to-cover adds To to all mail' '\n+\tclean_fake_sendmail &&\n+\trm -fr outdir &&\n+\tgit format-patch --cover-letter -2 -o outdir &&\n+\tgit send-email \\\n+\t  --force \\\n+\t  --from=\"Example <nobody@example.com>\" \\\n+\t  --to=nobody@example.com \\\n+\t  --smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t  outdir/0002-*.patch \\\n+\t  outdir/0000-*.patch \\\n+\t  outdir/0001-*.patch \\\n+\t  2>errors >out &&\n+\t! grep \"SUBJECT HERE\" errors &&\n+\ttest -n \"$(ls msgtxt*)\"\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":"238359","messageId":"xmqqa9c2qn6w.fsf@gitster.dls.corp.google.com","threadId":"36345","inReplyTo":"1396548814-27278-1-git-send-email-mst@redhat.com","subject":"Re: [PATCH v2 1/2] git-send-email: two new options: to-cover, cc-cover","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-04-03T18:31:51Z","receivedAt":"2014-04-03T18:31:51Z","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> Allow extracting To/Cc addresses from cover letter.\n\nPlease say what you are doing with what you extract, which is the\nmore important part of the objective.  Extracting is merely a step\nto achieve that.\n\ns/.$/, to be used as To/Cc addresses of the remainder of the series./\n\nor something.\n\n\nI think this will be a very handy feature.\n\nIf you have a series *and* you bothered to add To/Cc to the cover\nletter, it is likely that you want all the messages read by these\npeople [*1*].\n\n> @@ -1468,6 +1475,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\nWhat is stored away with this code to @initial_cc/to includes:\n\n - what was given to @initial_cc/to before ll.1468-1469\n - what was in @cc/to before ll.1468-1469\n\nwhen we see the first message [*2*].  The former come from the\ncommand line --to/--cc, and the latter comes from the header lines\nof the first message.  Am I reading the code correctly?\n\nIf that is the case, I think the updated code makes sense.\n\nThanks.\n\n\n[Footnote]\n\n*1* Allowing this to be disabled is also a good thing this patch\n    does.  A 100 patch series that does a tree-wide clean-up may\n    have different set of people on To/Cc of individual patches, and\n    you may want the union of them on To/Cc on the cover letter, so\n    that a person may get the cover letter and a single patch that\n    relates to his area of expertise without having to see the\n    remainder.\n\n*2* The first message may not necessarily be the cover letter.  Is\n    there a reliable way to detect that?  The user may want to send\n    out a series with only a few patches without any cover, and\n    taking To/Cc from the [PATCH 1/3] and propagating them to the\n    rest does not match what the documentation and the option name\n    claim to do.\n"},{"id":"238361","messageId":"xmqq61mqqmlu.fsf@gitster.dls.corp.google.com","threadId":"36345","inReplyTo":"1396548814-27278-2-git-send-email-mst@redhat.com","subject":"Re: [PATCH v2 2/2] test/send-email: add to-cover test","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-04-03T18:44:29Z","receivedAt":"2014-04-03T18:44:29Z","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> Does it work? I am not sure.\n\nThen why was it sent here?\n\n> diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\n> index 3119c8c..3b17884 100755\n> --- a/t/t9001-send-email.sh\n> +++ b/t/t9001-send-email.sh\n> @@ -1334,6 +1334,22 @@ test_expect_success $PREREQ '--force sends cover letter template anyway' '\n>  \ttest -n \"$(ls msgtxt*)\"\n>  '\n>  \n> +test_expect_success $PREREQ 'to-cover adds To to all mail' '\n> +\tclean_fake_sendmail &&\n> +\trm -fr outdir &&\n> +\tgit format-patch --cover-letter -2 -o outdir &&\n> +\tgit send-email \\\n> +\t  --force \\\n> +\t  --from=\"Example <nobody@example.com>\" \\\n> +\t  --to=nobody@example.com \\\n> +\t  --smtp-server=\"$(pwd)/fake.sendmail\" \\\n> +\t  outdir/0002-*.patch \\\n> +\t  outdir/0000-*.patch \\\n> +\t  outdir/0001-*.patch \\\n> +\t  2>errors >out &&\n> +\t! grep \"SUBJECT HERE\" errors &&\n> +\ttest -n \"$(ls msgtxt*)\"\n> +'\n\nIs this a copy of an existing \"--force can disable the safety to\ncatch a mistake to send a cover letter template without any update\"?\n\nHow are you checking if you are propagating to/cc from the cover to\nother messages with this test?\n\nPuzzled.\n"},{"id":"238364","messageId":"CAPig+cQB4iTH8W-4HFrRk5KQe5OrBaz0WN24iYWqRrHCq5u4rA@mail.gmail.com","threadId":"36345","inReplyTo":"1396548814-27278-1-git-send-email-mst@redhat.com","subject":"Re: [PATCH v2 1/2] git-send-email: two new options: to-cover, cc-cover","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2014-04-03T21:24:23Z","receivedAt":"2014-04-03T21:24:23Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Apr 3, 2014 at 2:14 PM, Michael S. Tsirkin <mst@redhat.com> wrote:\n> Allow extracting To/Cc addresses from cover letter.\n>\n> Signed-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>\n> diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\n> index f0e57a5..1733664 100644\n> --- a/Documentation/git-send-email.txt\n> +++ b/Documentation/git-send-email.txt\n> @@ -248,6 +248,18 @@ Automating\n>         cc list. Default is the value of 'sendemail.signedoffbycc' configuration\n>         value; if that is unspecified, default to --signed-off-by-cc.\n>\n> +--[no-]cc-cover::\n> +       If this is set, emails found in Cc: headers in the cover letter are\n> +       added to the cc list for each email set. Default is the value of\n\ns/email set/email sent/\n\n> +       'sendemail.cccover' configuration value; if that is unspecified,\n> +       default to --no-cc-cover.\n> +\n> +--[no-]to-cover::\n> +       If this is set, emails found in To: headers in the cover letter are\n> +       added to the to list for each email set. Default is the value of\n\nDitto.\n\n> +       'sendemail.tocover' configuration value; if that is unspecified,\n> +       default to --no-to-cover.\n> +\n>  --suppress-cc=<category>::\n>         Specify an additional category of recipients to suppress the\n>         auto-cc of:\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index 8bbfb84..11d9a46 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>                     \"suppress-from!\" => \\$suppress_from,\n>                     \"suppress-cc=s\" => \\@suppress_cc,\n>                     \"signed-off-cc|signed-off-by-cc!\" => \\$signed_off_by_cc,\n> +                   \"cc-cover|cc-cover!\" => \\$cover_cc,\n> +                   \"to-cover|to-cover!\" => \\$cover_to,\n>                     \"confirm=s\" => \\$confirm,\n>                     \"dry-run\" => \\$dry_run,\n>                     \"envelope-sender=s\" => \\$envelope_sender,\n> @@ -1468,6 +1475,15 @@ foreach my $t (@files) {\n>         @to = (@initial_to, @to);\n>         @cc = (@initial_cc, @cc);\n>\n> +       if ($message_num == 1) {\n> +               if (defined $cover_cc and $cover_cc) {\n> +                       @initial_cc = @cc;\n> +               }\n> +               if (defined $cover_to and $cover_to) {\n> +                       @initial_to = @to;\n> +               }\n> +       }\n> +\n>         my $message_was_sent = send_message();\n>\n>         # set up for the next message\n> --\n> MST\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"239816","messageId":"20140427183643.GB28551@redhat.com","threadId":"36345","inReplyTo":"xmqqa9c2qn6w.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v2 1/2] git-send-email: two new options: to-cover, cc-cover","fromName":"Michael S. Tsirkin","fromEmail":"mst@redhat.com","sentAt":"2014-04-27T18:36:43Z","receivedAt":"2014-04-27T18:36:43Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"On Thu, Apr 03, 2014 at 11:31:51AM -0700, Junio C Hamano wrote:\n> \"Michael S. Tsirkin\" <mst@redhat.com> writes:\n> \n> > Allow extracting To/Cc addresses from cover letter.\n> \n> Please say what you are doing with what you extract, which is the\n> more important part of the objective.  Extracting is merely a step\n> to achieve that.\n> \n> s/.$/, to be used as To/Cc addresses of the remainder of the series./\n> \n> or something.\n> \n\nthanks, I did that in the new version.\n\n\n> I think this will be a very handy feature.\n> \n> If you have a series *and* you bothered to add To/Cc to the cover\n> letter, it is likely that you want all the messages read by these\n> people [*1*].\n> \n> > @@ -1468,6 +1475,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> \n> What is stored away with this code to @initial_cc/to includes:\n> \n>  - what was given to @initial_cc/to before ll.1468-1469\n>  - what was in @cc/to before ll.1468-1469\n> \n> when we see the first message [*2*].  The former come from the\n> command line --to/--cc, and the latter comes from the header lines\n> of the first message.  Am I reading the code correctly?\n\nExactly.\n\n> If that is the case, I think the updated code makes sense.\n> \n> Thanks.\n> \n> \n> [Footnote]\n> \n> *1* Allowing this to be disabled is also a good thing this patch\n>     does.  A 100 patch series that does a tree-wide clean-up may\n>     have different set of people on To/Cc of individual patches, and\n>     you may want the union of them on To/Cc on the cover letter, so\n>     that a person may get the cover letter and a single patch that\n>     relates to his area of expertise without having to see the\n>     remainder.\n> \n> *2* The first message may not necessarily be the cover letter.  Is\n>     there a reliable way to detect that?\n\n\n>  The user may want to send\n>     out a series with only a few patches without any cover, and\n>     taking To/Cc from the [PATCH 1/3] and propagating them to the\n>     rest does not match what the documentation and the option name\n>     claim to do.\n\nTwo things that come to mind:\n\t- check that subject has 0000/\n\t\tNeeds some manual parsing, I don't like this much\n\t- check that there's no patch\n\t\tWe could try running git mailinfo but it might give\n\t\tfalse negatives if cover letter happens to have\n\t\t\t---\n\t\t\tdiff a/foo b/bar\n\t\twithin it.\n\t\tWorth worrying about?\n\nFor now I simply updated the documentation.\n\n-- \nMST\n"}]}