git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH V2] git-send-email: Add ability to cc: any "bylines" in the commit message

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 31, 2016, 19:34 UTC
Message-ID
<xmqq4m6020nh.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<aa4c9e0b37e70423baa69bc27cc9adda0f152efe.1472669418.git.joe@perches.com>
Joe Perches <joe@perches.com> writes:
> Many commits have various forms of bylines similar to
A missing blank line (I can tweak while queuing).
Show 12 quoted lines
>      "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:".

Show 6 quoted lines
> @@ -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@...>"
Show 8 quoted lines
>  			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.
Previous: Joe PerchesNext: Joe Perches
Message 2 of 5 in “git-send-email: Add ability to cc: any "bylines" in the commit message”
  1. git-send-email: Add ability to cc: any "bylines" in the commit messageJoe Perches, Aug 31, 2016
  2. Junio C HamanoAug 31, 2016
  3. Joe PerchesAug 31, 2016
  4. Junio C HamanoAug 31, 2016
  5. Jeff KirsherAug 31, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.