author | Junio C Hamano <gitster@pobox.com> | |
Fri, 16 Dec 2011 23:44:18 +0000 (15:44 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 19 Dec 2011 04:40:41 +0000 (20:40 -0800) | ||
commit | 8496f568739626c86cb9d82e57fc0b55cb4c0849 | |
tree | 75604da441ec3291752363cb6a406e2b5b43ad57 | tree | snapshot |
parent | 87afe9a5ed759668e35513c44eacd2fd393ba658 | commit | diff |
lf_to_crlf_filter(): resurrect CRLF->CRLF hack
The non-streaming version of the filter counts CRLF and LF in the whole
buffer, and returns without doing anything when they match (i.e. what is
recorded in the object store already uses CRLF). This was done to help
people who added files from the DOS world before realizing they want to go
cross platform and adding .gitattributes to tell Git that they only want
CRLF in their working tree.
The streaming version of the filter does not want to read the whole thing
before starting to work, as that defeats the whole point of streaming. So
we instead check what byte follows CR whenever we see one, and add CR
before LF only when the LF does not immediately follow CR already to keep
CRLF as is.
Reported-and-tested-by: Ralf Thielow
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The non-streaming version of the filter counts CRLF and LF in the whole
buffer, and returns without doing anything when they match (i.e. what is
recorded in the object store already uses CRLF). This was done to help
people who added files from the DOS world before realizing they want to go
cross platform and adding .gitattributes to tell Git that they only want
CRLF in their working tree.
The streaming version of the filter does not want to read the whole thing
before starting to work, as that defeats the whole point of streaming. So
we instead check what byte follows CR whenever we see one, and add CR
before LF only when the LF does not immediately follow CR already to keep
CRLF as is.
Reported-and-tested-by: Ralf Thielow
Signed-off-by: Junio C Hamano <gitster@pobox.com>
convert.c | diff | blob | history |