git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: Junio C Hamano <gitster@pobox.com>
Cc: Joe Perches <joe@perches.com>,
	Rasmus Villemoes <rv@rasmusvillemoes.dk>,
	git@vger.kernel.org
Subject: Re: [PATCH] send-email: don't cc *-by lines with '-' prefix
Date: Thu, 04 Apr 2019 10:38:46 +0300	[thread overview]
Message-ID: <874l7ekynt.fsf@tarshish> (raw)
In-Reply-To: <xmqqh8c03dcz.fsf@gitster-ct.c.googlers.com>

Hi Junio,

On Mon, Mar 18 2019, Junio C. Hamano wrote:
> 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

>> ---
>>  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 -

  parent reply	other threads:[~2019-04-04  7:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-16 19:26 [PATCH] send-email: don't cc *-by lines with '-' prefix Baruch Siach
2019-03-16 19:30 ` Joe Perches
2019-03-16 19:49   ` Baruch Siach
2019-03-16 19:59     ` Joe Perches
2019-03-16 20:14       ` Baruch Siach
2019-03-16 20:23         ` Joe Perches
2019-03-17 19:27 ` Rasmus Villemoes
2019-03-18  1:56   ` Joe Perches
2019-03-18  6:28     ` Junio C Hamano
2019-03-18  7:02       ` Joe Perches
2019-04-04  7:38       ` Baruch Siach [this message]
2019-04-04  9:20         ` Junio C Hamano
2019-04-04  9:27           ` Baruch Siach
2019-04-04  9:41             ` Junio C Hamano
2019-04-04  9:42             ` Rasmus Villemoes
2019-04-04  9:47               ` Junio C Hamano
2019-04-04 12:14               ` Jeff King
2019-04-04  9:49 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874l7ekynt.fsf@tarshish \
    --to=baruch@tkos.co.il \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=joe@perches.com \
    --cc=rv@rasmusvillemoes.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).