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

Re: [PATCH] send-email: don't cc *-by lines with '-' prefix

From
Baruch Siach <baruch@tkos.co.il>
Date
Apr 4, 2019, 07:38 UTC
Message-ID
<874l7ekynt.fsf@tarshish>
In-Reply-To
<xmqqh8c03dcz.fsf@gitster-ct.c.googlers.com>
Hi Junio,
On Mon, Mar 18 2019, Junio C. Hamano wrote:
Show 18 quoted lines
> Joe Perches <joe@perches.com> writes:
>
>> My preference would be for correctness.
>> I presume something like this isn't too onerous.
>
> I am guessing that /^---/ is to stop at the three-dash line *OR*
> after the initial handful of lines of the first diff header (as the
> last resort) and that is why it is not looking for /^---$/.
>
> If that is the case, I think it makes a lot of sense.  It is a
> general improvement not tied to the case that triggered this thread.
>
> Independently, I think it makes sense to do something like
>
> 	/^([a-z][a-z-]*-by|Cc): (.*)/i
>
> to tighten the match to exclude a non-trailer; that would have been
> sufficient for the original case that triggered this thread.

Is there anything I need to do more to get this fix applied for the next git release?

Thanks, baruch

Show 29 quoted lines
>> ---
>>  git-send-email.perl | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/git-send-email.perl b/git-send-email.perl
>> index 8200d58cdc..83b0429576 100755
>> --- a/git-send-email.perl
>> +++ b/git-send-email.perl
>> @@ -1697,9 +1697,10 @@ sub process_file {
>>  		}
>>  	}
>>  	# Now parse the message body
>> +	my $in_patch = 0;
>>  	while(<$fh>) {
>>  		$message .=  $_;
>> -		if (/^([a-z-]*-by|Cc): (.*)/i) {
>> +		if (!$in_patch && /^([a-z-]*-by|Cc): (.*)/i) {
>>  			chomp;
>>  			my ($what, $c) = ($1, $2);
>>  			# strip garbage for the address we'll use:
>> @@ -1725,6 +1726,8 @@ sub process_file {
>>  			push @cc, $c;
>>  			printf(__("(body) Adding cc: %s from line '%s'\n"),
>>  				$c, $_) unless $quiet;
>> +		} elsif (/^---/) {
>> +			$in_patch = 1;
>>  		}
>>  	}
>>  	close $fh;
--
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
Previous: Joe PerchesNext: Junio C Hamano
Message 11 of 18 in “send-email: don't cc *-by lines with '-' prefix”
  1. send-email: don't cc *-by lines with '-' prefixBaruch Siach, Mar 16, 2019
  2. Joe PerchesMar 16, 2019
  3. Baruch SiachMar 16, 2019
  4. Joe PerchesMar 16, 2019
  5. Baruch SiachMar 16, 2019
  6. Joe PerchesMar 16, 2019
  7. Rasmus VillemoesMar 17, 2019
  8. Joe PerchesMar 18, 2019
  9. Junio C HamanoMar 18, 2019
  10. Joe PerchesMar 18, 2019
  11. Baruch SiachApr 4, 2019
  12. Junio C HamanoApr 4, 2019
  13. Baruch SiachApr 4, 2019
  14. Junio C HamanoApr 4, 2019
  15. Rasmus VillemoesApr 4, 2019
  16. Junio C HamanoApr 4, 2019
  17. Junio C HamanoApr 4, 2019
  18. Jeff KingApr 4, 2019

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.