Re: [PATCH v4 8/9] add -p: fix counting when splitting and coalescing

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

 



Phillip Wood <phillip.wood@xxxxxxxxxxxx> writes:

> @@ -887,8 +892,8 @@ sub merge_hunk {
>  	$o_cnt = $n_cnt = 0;
>  	for ($i = 1; $i < @{$prev->{TEXT}}; $i++) {
>  		my $line = $prev->{TEXT}[$i];
> -		if ($line =~ /^\+/) {
> -			$n_cnt++;
> +		if ($line =~ /^[+\\]/) {
> +			$n_cnt++ if ($line =~ /^\+/);
>  			push @line, $line;
>  			next;
>  		}

Hmmmm, the logic may be correct, but this looks like a result of
attempting to minimize the number of changed lines and ending up
with a less-than-readble code.  "If the line begins with a plus or
backslash, do these things, the first of which is done only when
the line begins with a plus."  The same comment for the other hunk
that counts the $this side.



[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