Re: [PATCH v3 4/8] gitweb: Extract print_sidebyside_diff_lines()

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

 



Michał Kiedrowicz <michal.kiedrowicz@xxxxxxxxx> writes:

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


> -		# 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?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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