diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-08-23 00:57:18 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-08-23 14:38:43 -0700 |
commit | 3b5ef0e216d20a49dac223eb985c22c56512dbec (patch) | |
tree | 7db282ec66eaf92ce4198f377eb012045f23c5bc /merge-index.c | |
parent | xutils: Fix hashing an incomplete line with whitespaces at the end (diff) | |
download | tgif-3b5ef0e216d20a49dac223eb985c22c56512dbec.tar.xz |
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>
Diffstat (limited to 'merge-index.c')
0 files changed, 0 insertions, 0 deletions