Thread (1 message) 1 message, 1 author, 2016-06-15

Re: Bug: git log --numstat counts wrong

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:06

Tay Ray Chuan [off-list ref] writes:
On further thought, I think the patch merely side-steps the problem -
ie. that -U0 generates "incorrect" diffs.
I do not know if there anything "incorrect" about it.

When the file have common blocks lines in different places that are not
modified, the comparison between preimage and postimage is free to choose
how these common blocks are matched, and for that reason it is incorrect
to expect that "diff -U0", "diff -U3" and "diff -U20" would produce the
identical results.
I think this function is incorrect. xdl_cleanup_records() and
xdl_clean_mmatch() may potentially look into common tail lines, so it
may not be "safe" to drop all common tail lines.
I would prefer to keep that common trimming optimization, and also to see
the same common trimming logic extended to trim (and adjust offsets) at
the beginning as well in the longer term.  If xdl_cleanup_records() and
xdl_clean_mmatch() need to become aware of the change in the total number
of lines made by trim_common_tail(), please make it so.
quoted hunk
-- >8 --
diff --git a/xdiff-interface.c b/xdiff-interface.c
index 0e2c169..da4fab6 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -131,7 +131,7 @@
        mmfile_t a = *mf1;
        mmfile_t b = *mf2;

-       trim_common_tail(&a, &b, xecfg->ctxlen);
+/*     trim_common_tail(&a, &b, xecfg->ctxlen);  */

        return xdl_diff(&a, &b, xpp, xecfg, xecb);
 }
-- >8 --
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help