{"thread":{"id":"43971","subject":"[PATCH V2] git-send-email: Add ability to cc: any \"bylines\" in the commit message","startedAt":"2016-08-31T18:51:41Z","lastAt":"2016-08-31T22:11:36Z","messageCount":5,"participants":["Joe Perches","Junio C Hamano","Jeff Kirsher"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"300717","messageId":"aa4c9e0b37e70423baa69bc27cc9adda0f152efe.1472669418.git.joe@perches.com","threadId":"43971","inReplyTo":null,"subject":"[PATCH V2] git-send-email: Add ability to cc: any \"bylines\" in the commit message","fromName":"Joe Perches","fromEmail":"joe@perches.com","sentAt":"2016-08-31T18:51:19Z","receivedAt":"2016-08-31T18:51:41Z","isPatch":true,"sender":{"key":"joe@perches.com","avatar":"https://avatars.githubusercontent.com/u/13122723?v=4"},"body":"Many commits have various forms of bylines similar to\n     \"Acked-by: Name <address>\" and \"Reported-by: Name <address>\"\n\nAdd the ability to cc: bylines (e.g. Acked-by:) when using git send-email.\n\nThis can be suppressed with --suppress-cc=bylines.\n\nSigned-off-by: Joe Perches <joe@perches.com>\n---\n Documentation/git-send-email.txt | 11 +++++++----\n git-send-email.perl              | 16 +++++++++++-----\n 2 files changed, 18 insertions(+), 9 deletions(-)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 642d0ef..0b0d945 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -278,9 +278,10 @@ Automating\n \tthe value of `sendemail.identity`.\n \n --[no-]signed-off-by-cc::\n-\tIf this is set, add emails found in Signed-off-by: or Cc: lines to the\n-\tcc list. Default is the value of `sendemail.signedoffbycc` configuration\n-\tvalue; if that is unspecified, default to --signed-off-by-cc.\n+\tIf this is set, add emails found in Signed-off-by: or Cc: or any other\n+\tbyline (e.g. Acked-by:) lines to the cc list. Default is the value of\n+\t`sendemail.signedoffbycc` configuration value; if that is unspecified,\n+\tdefault 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@@ -307,8 +308,10 @@ Automating\n   patch body (commit message) except for self (use 'self' for that).\n - 'sob' will avoid including anyone mentioned in Signed-off-by lines except\n    for self (use 'self' for that).\n+- 'bylines' will avoid including anyone mentioned in any \"<foo>-by:\" lines\n+  in the patch header except for Signed-off-by.\n - 'cccmd' will avoid running the --cc-cmd.\n-- 'body' is equivalent to 'sob' + 'bodycc'\n+- 'body' is equivalent to 'sob' + 'bodycc' + 'bylines'\n - 'all' will suppress all auto cc values.\n --\n +\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex da81be4..1f53328 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -84,7 +84,7 @@ git send-email --dump-aliases\n     --identity              <str>  * Use the sendemail.<id> 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+    --suppress-cc           <str>  * author, self, sob, cc, cccmd, body, bodycc, bylines, 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@@ -431,13 +431,13 @@ my(%suppress_cc);\n if (@suppress_cc) {\n \tforeach my $entry (@suppress_cc) {\n \t\tdie \"Unknown --suppress-cc field: '$entry'\\n\"\n-\t\t\tunless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc)$/;\n+\t\t\tunless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc|bylines)$/;\n \t\t$suppress_cc{$entry} = 1;\n \t}\n }\n \n if ($suppress_cc{'all'}) {\n-\tforeach my $entry (qw (cccmd cc author self sob body bodycc)) {\n+\tforeach my $entry (qw (cccmd cc author self sob body bodycc bylines)) {\n \t\t$suppress_cc{$entry} = 1;\n \t}\n \tdelete $suppress_cc{'all'};\n@@ -448,7 +448,7 @@ $suppress_cc{'self'} = $suppress_from if defined $suppress_from;\n $suppress_cc{'sob'} = !$signed_off_by_cc if defined $signed_off_by_cc;\n \n if ($suppress_cc{'body'}) {\n-\tforeach my $entry (qw (sob bodycc)) {\n+\tforeach my $entry (qw (sob bodycc bylines)) {\n \t\t$suppress_cc{$entry} = 1;\n \t}\n \tdelete $suppress_cc{'body'};\n@@ -1545,7 +1545,7 @@ foreach my $t (@files) {\n \t# Now parse the message body\n \twhile(<$fh>) {\n \t\t$message .=  $_;\n-\t\tif (/^(Signed-off-by|Cc): (.*)$/i) {\n+\t\tif (/^(Signed-off-by|Cc|[^\\s]+[\\w-]by): (.*)$/i) {\n \t\t\tchomp;\n \t\t\tmy ($what, $c) = ($1, $2);\n \t\t\tchomp $c;\n@@ -1555,6 +1555,12 @@ foreach my $t (@files) {\n \t\t\t} else {\n \t\t\t\tnext if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i;\n \t\t\t\tnext if $suppress_cc{'bodycc'} and $what =~ /Cc/i;\n+\t\t\t\tnext if $suppress_cc{'bylines'} and $what !~ /Signed-off-by/i and $what =~ /by$/i;\n+\t\t\t}\n+\t\t\tif ($c !~ /.+@.+/) {\n+\t\t\t\tprintf(\"(body) Ignoring %s from line '%s'\\n\",\n+\t\t\t\t       $what, $_) unless $quiet;\n+\t\t\t\tnext;\n \t\t\t}\n \t\t\tpush @cc, $c;\n \t\t\tprintf(\"(body) Adding cc: %s from line '%s'\\n\",\n-- \n2.10.0.rc2.1.gaa4c9e0\n\n"},{"id":"300722","messageId":"xmqq4m6020nh.fsf@gitster.mtv.corp.google.com","threadId":"43971","inReplyTo":"aa4c9e0b37e70423baa69bc27cc9adda0f152efe.1472669418.git.joe@perches.com","subject":"Re: [PATCH V2] git-send-email: Add ability to cc: any \"bylines\" in the commit message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-31T19:34:10Z","receivedAt":"2016-08-31T19:35:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Joe Perches <joe@perches.com> writes:\n\n> Many commits have various forms of bylines similar to\n\nA missing blank line (I can tweak while queuing).\n\n>      \"Acked-by: Name <address>\" and \"Reported-by: Name <address>\"\n>\n> Add the ability to cc: bylines (e.g. Acked-by:) when using git send-email.\n>\n> This can be suppressed with --suppress-cc=bylines.\n> ...\n> @@ -307,8 +308,10 @@ Automating\n>    patch body (commit message) except for self (use 'self' for that).\n>  - 'sob' will avoid including anyone mentioned in Signed-off-by lines except\n>     for self (use 'self' for that).\n> +- 'bylines' will avoid including anyone mentioned in any \"<foo>-by:\" lines\n> +  in the patch header except for Signed-off-by.\n\n<foo> feels a bit too informal but I don't think of a better\nalternative, perhaps other than \"*-by:\".\n\n> @@ -1545,7 +1545,7 @@ foreach my $t (@files) {\n>  \t# Now parse the message body\n>  \twhile(<$fh>) {\n>  \t\t$message .=  $_;\n> -\t\tif (/^(Signed-off-by|Cc): (.*)$/i) {\n> +\t\tif (/^(Signed-off-by|Cc|[^\\s]+[\\w-]by): (.*)$/i) {\n\nI thought you wanted\n\n\t\tif (/^(Signed-off-by|Cc|[\\w-]+-by): (.*)$/i) {\n\ninstead to avoid \"O_=:;fooby: Joe Perches <joe@...>\"\n>  \t\t\tchomp;\n>  \t\t\tmy ($what, $c) = ($1, $2);\n>  \t\t\tchomp $c;\n> @@ -1555,6 +1555,12 @@ foreach my $t (@files) {\n>  \t\t\t} else {\n>  \t\t\t\tnext if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i;\n>  \t\t\t\tnext if $suppress_cc{'bodycc'} and $what =~ /Cc/i;\n> +\t\t\t\tnext if $suppress_cc{'bylines'} and $what !~ /Signed-off-by/i and $what =~ /by$/i;\n\nHaving to keep this /by$/i in sync with whatever definition of\nbylines is will be error prone.  How about doing it in this way?\n\n\t# Now parse the message body\n+\tmy $bypat = r/[\\w-]+-by/;\n\twhile (<$fh>) {\n        \t...\n                if (/^(Signed-off-by|Cc|$bypat): (.*)$/i) {\n                \t...\n                        \tnext if $suppress_cc{'bodycc'} and $what =~ /Cc/i;\n+\t\t\t\tnext if $suppress_cc{'bylines'} and\n+\t\t\t\t\t$what !~ /^Signed-off-by/i and\n+\t\t\t\t\t$what =~ /^$bypat/i;\n\nOther than that, looking good.\n"},{"id":"300723","messageId":"1472672344.4176.32.camel@perches.com","threadId":"43971","inReplyTo":"xmqq4m6020nh.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH V2] git-send-email: Add ability to cc: any \"bylines\" in the commit message","fromName":"Joe Perches","fromEmail":"joe@perches.com","sentAt":"2016-08-31T19:39:04Z","receivedAt":"2016-08-31T19:39:24Z","isPatch":true,"sender":{"key":"joe@perches.com","avatar":"https://avatars.githubusercontent.com/u/13122723?v=4"},"body":"On Wed, 2016-08-31 at 12:34 -0700, Junio C Hamano wrote:\n> Joe Perches <joe@perches.com> writes:\n> > Many commits have various forms of bylines similar to\n> A missing blank line (I can tweak while queuing).\n[]\n> > +\t\t\t\tnext if $suppress_cc{'bylines'} and $what !~ /Signed-off-by/i and $what =~ /by$/i;\n> Having to keep this /by$/i in sync with whatever definition of\n> bylines is will be error prone.  How about doing it in this way?\n> \n> \t# Now parse the message body\n> +\tmy $bypat = r/[\\w-]+-by/;\n> \twhile (<$fh>) {\n>         \t...\n>                 if (/^(Signed-off-by|Cc|$bypat): (.*)$/i) {\n>                 \t...\n>                         \tnext if $suppress_cc{'bodycc'} and $what =~ /Cc/i;\n> +\t\t\t\tnext if $suppress_cc{'bylines'} and\n> +\t\t\t\t\t$what !~ /^Signed-off-by/i and\n> +\t\t\t\t\t$what =~ /^$bypat/i;\n> \n> Other than that, looking good.\n\nSure, whatever you want, do you want a v3 from me or can\nyou fix it up however you want?\n\n"},{"id":"300727","messageId":"xmqqr394zon1.fsf@gitster.mtv.corp.google.com","threadId":"43971","inReplyTo":"1472672344.4176.32.camel@perches.com","subject":"Re: [PATCH V2] git-send-email: Add ability to cc: any \"bylines\" in the commit message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-08-31T20:09:38Z","receivedAt":"2016-08-31T20:09:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Joe Perches <joe@perches.com> writes:\n\n> On Wed, 2016-08-31 at 12:34 -0700, Junio C Hamano wrote:\n>> Joe Perches <joe@perches.com> writes:\n>> > Many commits have various forms of bylines similar to\n>> A missing blank line (I can tweak while queuing).\n> []\n>> > +\t\t\t\tnext if $suppress_cc{'bylines'} and $what !~ /Signed-off-by/i and $what =~ /by$/i;\n>> Having to keep this /by$/i in sync with whatever definition of\n>> bylines is will be error prone.  How about doing it in this way?\n>> \n>> \t# Now parse the message body\n>> +\tmy $bypat = r/[\\w-]+-by/;\n>> \twhile (<$fh>) {\n>>         \t...\n>>                 if (/^(Signed-off-by|Cc|$bypat): (.*)$/i) {\n>>                 \t...\n>>                         \tnext if $suppress_cc{'bodycc'} and $what =~ /Cc/i;\n>> +\t\t\t\tnext if $suppress_cc{'bylines'} and\n>> +\t\t\t\t\t$what !~ /^Signed-off-by/i and\n>> +\t\t\t\t\t$what =~ /^$bypat/i;\n>> \n>> Other than that, looking good.\n>\n> Sure, whatever you want, do you want a v3 from me or can\n> you fix it up however you want?\n\nThis topic is not my itch, so \"however I want\" would not be a good\ninstruction to me--The lazy one in me would be tempted to say \"ok,\nthen I'd drop it altogether\" ;-)\n\nI am sure the typo \"[^\\s]+[\\w-]by\" in the one we just saw was merely\nbecause you rushed it out without double checking.  We are in\npre-release feature freeze so there is no need to rush.  I'd prefer\nto see a final version that is carefully proof-read by the author.\n\nThanks.\n"},{"id":"300747","messageId":"1472681445.2268.45.camel@gmail.com","threadId":"43971","inReplyTo":"aa4c9e0b37e70423baa69bc27cc9adda0f152efe.1472669418.git.joe@perches.com","subject":"Re: [PATCH V2] git-send-email: Add ability to cc: any \"bylines\" in the commit message","fromName":"Jeff Kirsher","fromEmail":"tarbal@gmail.com","sentAt":"2016-08-31T22:10:45Z","receivedAt":"2016-08-31T22:11:36Z","isPatch":true,"sender":{"key":"tarbal@gmail.com","avatar":null},"body":"On Wed, 2016-08-31 at 11:51 -0700, Joe Perches wrote:\n> Many commits have various forms of bylines similar to\n>      \"Acked-by: Name <address>\" and \"Reported-by: Name <address>\"\n> \n> Add the ability to cc: bylines (e.g. Acked-by:) when using git send-\n> email.\n> \n> This can be suppressed with --suppress-cc=bylines.\n> \n> Signed-off-by: Joe Perches <joe@perches.com>\n> ---\n>  Documentation/git-send-email.txt | 11 +++++++----\n>  git-send-email.perl              | 16 +++++++++++-----\n>  2 files changed, 18 insertions(+), 9 deletions(-)\n\nAcked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>"}]}