author | Junio C Hamano <gitster@pobox.com> | |
Sun, 23 Aug 2009 07:51:09 +0000 (00:51 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 23 Aug 2009 20:17:59 +0000 (13:17 -0700) | ||
commit | 78ed710fcf1a67a40eeca1be1a1bb8e8b7296177 | |
tree | d45e4b431dce96f6f7a8e4440370d865d84008ba | tree | snapshot |
parent | 0d5055665ca1e76659ffa96bf972b4b0125ea069 | commit | diff |
xutils: Fix hashing an incomplete line with whitespaces at the end
Upon seeing a whitespace, xdl_hash_record_with_whitespace() first skipped
the run of whitespaces (excluding LF) that begins there, ensuring that the
pointer points at the last whitespace character in the run, and assumed
that the next character must be LF at the end of the line. This does not
work when hashing an incomplete line, which lacks the LF at the end.
Introduce "at_eol" variable that is true when either we are at the end of
line (looking at LF) or at the end of an incomplete line, and use that
instead throughout the code.
Noticed by Thell Fowler.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Upon seeing a whitespace, xdl_hash_record_with_whitespace() first skipped
the run of whitespaces (excluding LF) that begins there, ensuring that the
pointer points at the last whitespace character in the run, and assumed
that the next character must be LF at the end of the line. This does not
work when hashing an incomplete line, which lacks the LF at the end.
Introduce "at_eol" variable that is true when either we are at the end of
line (looking at LF) or at the end of an incomplete line, and use that
instead throughout the code.
Noticed by Thell Fowler.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
xdiff/xutils.c | diff | blob | history |