Re: [PATCH v4 8/9] add -p: fix counting when splitting and coalescing
On 01/03/18 20:29, Junio C Hamano wrote:
Show 21 quoted lines
> Phillip Wood <phillip.wood@talktalk.net> 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.
> Right, I'll re-roll with a separate clause for the "\ No new line .." lines.