Re: [PATCH v3 4/8] gitweb: Extract print_sidebyside_diff_lines()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 4, 2012, 21:47 UTC
- Message-ID
- <7vsjgj6ufi.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1333569433-3245-5-git-send-email-michal.kiedrowicz@gmail.com>
Michał Kiedrowicz <michal.kiedrowicz@gmail.com> writes:
Show 9 quoted lines
> + if (!@$add) {
> + # pure removal
> +...
> + } elsif (!@$rem) {
> + # pure addition
> +...
> + } else {
> + # assume that it is change
> + print join '',I know this is not a new problem, but if your patch hunk has both '-' and '+' lines, what's there to "assume" that it is a change? Isn't it always?
Show 6 quoted lines
> - # empty add/rem block on start context block, or end of chunk
> - if ((@rem || @add) && (!$class || $class eq 'ctx')) {
> -...
> + ## print from accumulator when have some add/rem lines or end
> + # of chunk (flush context lines)
> + if (((@rem || @add) && $class eq 'ctx') || !$class) {This seems to change the condition. Earlier, it held true if (there is anything to show), and (class is unset or equal to ctx). The new code says something different. Also can $class be undef, and if so, doesn't it trigger comparison between undef and 'ctx' by having !$class check at the end of || chain?