* [PATCH V2] git-send-email: Add ability to cc: any "bylines" in the commit message
@ 2016-08-31 18:51 Joe Perches
2016-08-31 19:34 ` Junio C Hamano
2016-08-31 22:10 ` Jeff Kirsher
0 siblings, 2 replies; 5+ messages in thread
From: Joe Perches @ 2016-08-31 18:51 UTC (permalink / raw
To: git, linux-kernel
Many commits have various forms of bylines similar to
"Acked-by: Name <address>" and "Reported-by: Name <address>"
Add the ability to cc: bylines (e.g. Acked-by:) when using git send-email.
This can be suppressed with --suppress-cc=bylines.
Signed-off-by: Joe Perches <joe@perches.com>
---
Documentation/git-send-email.txt | 11 +++++++----
git-send-email.perl | 16 +++++++++++-----
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 642d0ef..0b0d945 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -278,9 +278,10 @@ Automating
the value of `sendemail.identity`.
--[no-]signed-off-by-cc::
- If this is set, add emails found in Signed-off-by: or Cc: lines to the
- cc list. Default is the value of `sendemail.signedoffbycc` configuration
- value; if that is unspecified, default to --signed-off-by-cc.
+ If this is set, add emails found in Signed-off-by: or Cc: or any other
+ byline (e.g. Acked-by:) lines to the 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
@@ -307,8 +308,10 @@ Automating
patch body (commit message) except for self (use 'self' for that).
- 'sob' will avoid including anyone mentioned in Signed-off-by lines except
for self (use 'self' for that).
+- 'bylines' will avoid including anyone mentioned in any "<foo>-by:" lines
+ in the patch header except for Signed-off-by.
- 'cccmd' will avoid running the --cc-cmd.
-- 'body' is equivalent to 'sob' + 'bodycc'
+- 'body' is equivalent to 'sob' + 'bodycc' + 'bylines'
- 'all' will suppress all auto cc values.
--
+
diff --git a/git-send-email.perl b/git-send-email.perl
index da81be4..1f53328 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -84,7 +84,7 @@ git send-email --dump-aliases
--identity <str> * Use the sendemail.<id> 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.
+ --suppress-cc <str> * author, self, sob, cc, cccmd, body, bodycc, bylines, 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.
@@ -431,13 +431,13 @@ my(%suppress_cc);
if (@suppress_cc) {
foreach my $entry (@suppress_cc) {
die "Unknown --suppress-cc field: '$entry'\n"
- unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc)$/;
+ unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc|bylines)$/;
$suppress_cc{$entry} = 1;
}
}
if ($suppress_cc{'all'}) {
- foreach my $entry (qw (cccmd cc author self sob body bodycc)) {
+ foreach my $entry (qw (cccmd cc author self sob body bodycc bylines)) {
$suppress_cc{$entry} = 1;
}
delete $suppress_cc{'all'};
@@ -448,7 +448,7 @@ $suppress_cc{'self'} = $suppress_from if defined $suppress_from;
$suppress_cc{'sob'} = !$signed_off_by_cc if defined $signed_off_by_cc;
if ($suppress_cc{'body'}) {
- foreach my $entry (qw (sob bodycc)) {
+ foreach my $entry (qw (sob bodycc bylines)) {
$suppress_cc{$entry} = 1;
}
delete $suppress_cc{'body'};
@@ -1545,7 +1545,7 @@ foreach my $t (@files) {
# Now parse the message body
while(<$fh>) {
$message .= $_;
- if (/^(Signed-off-by|Cc): (.*)$/i) {
+ if (/^(Signed-off-by|Cc|[^\s]+[\w-]by): (.*)$/i) {
chomp;
my ($what, $c) = ($1, $2);
chomp $c;
@@ -1555,6 +1555,12 @@ foreach my $t (@files) {
} else {
next if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i;
next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
+ next if $suppress_cc{'bylines'} and $what !~ /Signed-off-by/i and $what =~ /by$/i;
+ }
+ if ($c !~ /.+@.+/) {
+ printf("(body) Ignoring %s from line '%s'\n",
+ $what, $_) unless $quiet;
+ next;
}
push @cc, $c;
printf("(body) Adding cc: %s from line '%s'\n",
--
2.10.0.rc2.1.gaa4c9e0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2] git-send-email: Add ability to cc: any "bylines" in the commit message
2016-08-31 18:51 [PATCH V2] git-send-email: Add ability to cc: any "bylines" in the commit message Joe Perches
@ 2016-08-31 19:34 ` Junio C Hamano
2016-08-31 19:39 ` Joe Perches
2016-08-31 22:10 ` Jeff Kirsher
1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2016-08-31 19:34 UTC (permalink / raw
To: Joe Perches; +Cc: git, linux-kernel
Joe Perches <joe@perches.com> writes:
> Many commits have various forms of bylines similar to
A missing blank line (I can tweak while queuing).
> "Acked-by: Name <address>" and "Reported-by: Name <address>"
>
> Add the ability to cc: bylines (e.g. Acked-by:) when using git send-email.
>
> This can be suppressed with --suppress-cc=bylines.
> ...
> @@ -307,8 +308,10 @@ Automating
> patch body (commit message) except for self (use 'self' for that).
> - 'sob' will avoid including anyone mentioned in Signed-off-by lines except
> for self (use 'self' for that).
> +- 'bylines' will avoid including anyone mentioned in any "<foo>-by:" lines
> + in the patch header except for Signed-off-by.
<foo> feels a bit too informal but I don't think of a better
alternative, perhaps other than "*-by:".
> @@ -1545,7 +1545,7 @@ foreach my $t (@files) {
> # Now parse the message body
> while(<$fh>) {
> $message .= $_;
> - if (/^(Signed-off-by|Cc): (.*)$/i) {
> + if (/^(Signed-off-by|Cc|[^\s]+[\w-]by): (.*)$/i) {
I thought you wanted
if (/^(Signed-off-by|Cc|[\w-]+-by): (.*)$/i) {
instead to avoid "O_=:;fooby: Joe Perches <joe@...>"
> chomp;
> my ($what, $c) = ($1, $2);
> chomp $c;
> @@ -1555,6 +1555,12 @@ foreach my $t (@files) {
> } else {
> next if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i;
> next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
> + next if $suppress_cc{'bylines'} and $what !~ /Signed-off-by/i and $what =~ /by$/i;
Having to keep this /by$/i in sync with whatever definition of
bylines is will be error prone. How about doing it in this way?
# Now parse the message body
+ my $bypat = r/[\w-]+-by/;
while (<$fh>) {
...
if (/^(Signed-off-by|Cc|$bypat): (.*)$/i) {
...
next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
+ next if $suppress_cc{'bylines'} and
+ $what !~ /^Signed-off-by/i and
+ $what =~ /^$bypat/i;
Other than that, looking good.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] git-send-email: Add ability to cc: any "bylines" in the commit message
2016-08-31 19:34 ` Junio C Hamano
@ 2016-08-31 19:39 ` Joe Perches
2016-08-31 20:09 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2016-08-31 19:39 UTC (permalink / raw
To: Junio C Hamano; +Cc: git, linux-kernel
On Wed, 2016-08-31 at 12:34 -0700, Junio C Hamano wrote:
> Joe Perches <joe@perches.com> writes:
> > Many commits have various forms of bylines similar to
> A missing blank line (I can tweak while queuing).
[]
> > + next if $suppress_cc{'bylines'} and $what !~ /Signed-off-by/i and $what =~ /by$/i;
> Having to keep this /by$/i in sync with whatever definition of
> bylines is will be error prone. How about doing it in this way?
>
> # Now parse the message body
> + my $bypat = r/[\w-]+-by/;
> while (<$fh>) {
> ...
> if (/^(Signed-off-by|Cc|$bypat): (.*)$/i) {
> ...
> next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
> + next if $suppress_cc{'bylines'} and
> + $what !~ /^Signed-off-by/i and
> + $what =~ /^$bypat/i;
>
> Other than that, looking good.
Sure, whatever you want, do you want a v3 from me or can
you fix it up however you want?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] git-send-email: Add ability to cc: any "bylines" in the commit message
2016-08-31 19:39 ` Joe Perches
@ 2016-08-31 20:09 ` Junio C Hamano
0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2016-08-31 20:09 UTC (permalink / raw
To: Joe Perches; +Cc: git, linux-kernel
Joe Perches <joe@perches.com> writes:
> On Wed, 2016-08-31 at 12:34 -0700, Junio C Hamano wrote:
>> Joe Perches <joe@perches.com> writes:
>> > Many commits have various forms of bylines similar to
>> A missing blank line (I can tweak while queuing).
> []
>> > + next if $suppress_cc{'bylines'} and $what !~ /Signed-off-by/i and $what =~ /by$/i;
>> Having to keep this /by$/i in sync with whatever definition of
>> bylines is will be error prone. How about doing it in this way?
>>
>> # Now parse the message body
>> + my $bypat = r/[\w-]+-by/;
>> while (<$fh>) {
>> ...
>> if (/^(Signed-off-by|Cc|$bypat): (.*)$/i) {
>> ...
>> next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
>> + next if $suppress_cc{'bylines'} and
>> + $what !~ /^Signed-off-by/i and
>> + $what =~ /^$bypat/i;
>>
>> Other than that, looking good.
>
> Sure, whatever you want, do you want a v3 from me or can
> you fix it up however you want?
This topic is not my itch, so "however I want" would not be a good
instruction to me--The lazy one in me would be tempted to say "ok,
then I'd drop it altogether" ;-)
I am sure the typo "[^\s]+[\w-]by" in the one we just saw was merely
because you rushed it out without double checking. We are in
pre-release feature freeze so there is no need to rush. I'd prefer
to see a final version that is carefully proof-read by the author.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] git-send-email: Add ability to cc: any "bylines" in the commit message
2016-08-31 18:51 [PATCH V2] git-send-email: Add ability to cc: any "bylines" in the commit message Joe Perches
2016-08-31 19:34 ` Junio C Hamano
@ 2016-08-31 22:10 ` Jeff Kirsher
1 sibling, 0 replies; 5+ messages in thread
From: Jeff Kirsher @ 2016-08-31 22:10 UTC (permalink / raw
To: Joe Perches, git, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 625 bytes --]
On Wed, 2016-08-31 at 11:51 -0700, Joe Perches wrote:
> Many commits have various forms of bylines similar to
> "Acked-by: Name <address>" and "Reported-by: Name <address>"
>
> Add the ability to cc: bylines (e.g. Acked-by:) when using git send-
> email.
>
> This can be suppressed with --suppress-cc=bylines.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> Documentation/git-send-email.txt | 11 +++++++----
> git-send-email.perl | 16 +++++++++++-----
> 2 files changed, 18 insertions(+), 9 deletions(-)
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-08-31 22:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-31 18:51 [PATCH V2] git-send-email: Add ability to cc: any "bylines" in the commit message Joe Perches
2016-08-31 19:34 ` Junio C Hamano
2016-08-31 19:39 ` Joe Perches
2016-08-31 20:09 ` Junio C Hamano
2016-08-31 22:10 ` Jeff Kirsher
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).