> (gdb) p xe->xdf1.ha[0]
> $28 = 1
> (gdb) p xe->xdf2.ha[0]
> $29 = 1
>
> ok, so the lines are tracked as having the same hash index in the
> preprocessed ha lists too.
>
> so i dunno why this is happening, and i'm wondering if it could be because of
> some check in the diff implementation that skips setting rchg if it already
> is. this codebase has had many people working on it over the years and
> different approaches to things have accumulated.
>
> but now i get to step into the git xdiff code and see !!
before i step into the git xdiff code i did notice this important-looking thing:
859 /*
860 * Allocate and setup K vectors to be used by the
differential
861 * algorithm.
862 *
863 * One is to store the forward path and one to store
the backward path.
864 */
865 ndiags = xe->xdf1.nreff + xe->xdf2.nreff + 3;
866 kvd.resize(2 * (size_t)ndiags + 2);
Line 866 (with indentation tab/space mismatches) resizes an array. The first
time this is run, it'll be full of zeros, but after that it won't be! Lemme fix
that.
member variable: std::vector<long> kvd; /* stores path vectors in default
algorithm */
$ git diff diff_xdiff.cpp
diff --git a/src/diff_xdiff.cpp b/src/diff_xdiff.cpp
index 6fd8cba..94db2fa 100644
--- a/src/diff_xdiff.cpp
+++ b/src/diff_xdiff.cpp
@@ -863,7 +863,7 @@ private:
* One is to store the forward path and one to store the
backward path.
*/
ndiags = xe->xdf1.nreff + xe->xdf2.nreff + 3;
- kvd.resize(2 * (size_t)ndiags + 2);
+ kvd.assign(2 * (size_t)ndiags + 2, 0);
kvdf = kvd.data();
kvdb = kvdf + ndiags;
kvdf += xe->xdf2.nreff + 1;
didn't fix it!