git/xdiff
Junio C Hamano 3b5ef0e216 xutils: Fix xdl_recmatch() on incomplete lines
Thell Fowler noticed that various "ignore whitespace" options to git diff
do not work well on an incomplete line.

The loop control of the function responsible for these bugs was extremely
difficult to follow.  This patch restructures the loops for three variants
of "ignore whitespace" logic.

The basic idea of the re-written logic is:

 - A loop runs while the characters from both strings we are looking at
   match.  We declare unmatch immediately when we find something that does
   not match and return false from the function.  We break out of the loop
   if we ran out of either side of the string.

   The way we skip spaces inside this loop varies depending on the style
   of ignoring whitespaces.

 - After the above loop breaks, we know that the parts of the strings we
   inspected so far match, ignoring the whitespaces.  The lines can match
   only if the remainder consists of nothing but whitespaces.  This part
   of the logic is shared across all three styles.

The new code is more obvious and should be much easier to follow.

Tested-by: Thell Fowler <git@tbfowler.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-23 14:38:43 -07:00
..
xdiff.h Allow alternate "low-level" emit function from xdl_diff 2008-10-25 12:09:31 -07:00
xdiffi.c Allow alternate "low-level" emit function from xdl_diff 2008-10-25 12:09:31 -07:00
xdiffi.h War on whitespace 2007-06-07 00:04:01 -07:00
xemit.c Allow alternate "low-level" emit function from xdl_diff 2008-10-25 12:09:31 -07:00
xemit.h Allow alternate "low-level" emit function from xdl_diff 2008-10-25 12:09:31 -07:00
xinclude.h War on whitespace 2007-06-07 00:04:01 -07:00
xmacros.h War on whitespace 2007-06-07 00:04:01 -07:00
xmerge.c xmerge.c: "diff3 -m" style clips merge reduction level to EAGER or less 2008-08-30 19:41:43 -07:00
xprepare.c xdiff: give up scanning similar lines early 2008-12-02 23:45:37 -08:00
xprepare.h War on whitespace 2007-06-07 00:04:01 -07:00
xtypes.h War on whitespace 2007-06-07 00:04:01 -07:00
xutils.c xutils: Fix xdl_recmatch() on incomplete lines 2009-08-23 14:38:43 -07:00
xutils.h War on whitespace 2007-06-07 00:04:01 -07:00