Re: [PATCH] xdiff: print post-image for common records instead of pre-image

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

 



René Scharfe <rene.scharfe@xxxxxxxxxxxxxx> writes:

> Normally it doesn't matter if we show the pre-image or th post-image
> for the common parts of a diff because they are the same.  If
> white-space changes are ignored they can differ, though.  The
> new text after applying the diff is more interesting in that case,
> so show that instead of the old contents.
>
> Note: GNU diff shows the pre-image.
>
> Suggested-by: Junio C Hamano <gitster@xxxxxxxxx>
> Signed-off-by: Rene Scharfe <rene.scharfe@xxxxxxxxxxxxxx>

I was looking at this one again, and I think one possible downside of
showing post-image for the context lines is that the resulting patch would
not apply to the pre-image tree anymore. Probably GNU folks thought that
it is a big enough issue. Or perhaps they didn't simply care either way ;-)

In any case, showing pre-image lines as the context at least makes the
patch easier to apply, but the result would be different from the intended
post-image and would appear as if indentation fixes in the patch are
reverted, so you would need manual fix-up after applying such a patch
generated with (gnu) "diff -w".

I tried to generate an output from "show -w", with this change, on a
commit that is largely indentation fix. The resulting patch seems to apply
cleanly with "apply --ignore-space-change" to the parent of the commit
"show -w" was taken from; of course the result needs some manual fix-ups
for the indentation changes, but that is not a news anyway.  So I suspect
it won't be a huge downside and I think the benefit of being able to see
the post-image in the context when the user is more interested in how the
file looks like after the change outweighs it.

Thanks again.
--
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]