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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joe Perches <joe@xxxxxxxxxxx> 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.



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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux