Re: [RFH] xdiff shows trivially redundant diff.
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:23
Davide Libenzi [off-list ref] writes:
No problem. That's only an eye-issue though, since the diff is still a valid diff according to its definition where D=A-B => B+D==A && A-D==B From the day I released 0.18, xregression is continuosly running w/out any issue. I'll check it out though ...
There is another to report, when ctxlen == 0.
Between the attached files "diff -u0 8f352aa dd40a03", the
header for a hunk with only inserted lines misidentify the
original location.
For example, the first hunk says:
@@ -0,0 +6 @@
+#include "diff.h"
Which is inconsistent with what GNU diff says:
@@ -5,0 +6 @@
+#include "diff.h"
I've tried this patch but it is not right; the diff between the
attached two files show a 47-line hunk that inserts at line 400,
then the next 6-line hunk inserts at line 401 which is obviously
bogus.
diff --git a/xdiff/xutils.c b/xdiff/xutils.c
index afaada1..3e7f999 100644
--- a/xdiff/xutils.c
+++ b/xdiff/xutils.c@@ -244,7 +244,7 @@ int xdl_emit_hunk_hdr(long s1, long c1, memcpy(buf, "@@ -", 4); nb += 4; - nb += xdl_num_out(buf + nb, c1 ? s1: 0); + nb += xdl_num_out(buf + nb, c1 ? s1 : (s1-1)); if (c1 != 1) { memcpy(buf + nb, ",", 1);