Re: [PATCH v3 1/5] diff: move the fallback "--exit-code" code down

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

 



On Fri, Aug 18, 2023 at 04:59:28PM -0700, Junio C Hamano wrote:

> diff --git a/diff.c b/diff.c
> index d52db685f7..0ce678fc06 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -6551,6 +6551,21 @@ void diff_flush(struct diff_options *options)
>  		separator++;
>  	}
>  
> +	if (output_format & DIFF_FORMAT_PATCH) {
> +		if (separator) {

This step makes sense, but I did a double-take when looking at the
patch, because it is moving code _up_ rather than _down_. But the
problem is that the block you moved was larger than the intervening bit,
so the diff chose to flip-flop the context and changed bits.

Obviously orthogonal to your series, but I wonder if there's a way to
convince Git to show what actually happened. I don't think this is
really a heuristic or algorithm problem. Seeing the pre- and
post-images, it can't know whether it was "move A up" or "move B down",
and the "real" diff is simply much larger in this case.

-Peff



[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