summaryrefslogtreecommitdiff
path: root/symlinks.c
diff options
context:
space:
mode:
authorAndy Parkins <andyparkins@gmail.com>2007-05-18 12:33:32 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-05-19 00:02:47 (GMT)
commit760f0c62ef8980cc46422894791649b010cc480f (patch)
tree0cbe0b854d2784b0a1ca5d737d0d19e79b206f7d /symlinks.c
parent5e6cfc80e26a4d0ebac38cff74c2cdebbe66cd27 (diff)
downloadgit-760f0c62ef8980cc46422894791649b010cc480f.zip
git-760f0c62ef8980cc46422894791649b010cc480f.tar.gz
git-760f0c62ef8980cc46422894791649b010cc480f.tar.bz2
Fix crlf attribute handling to match documentation
gitattributes.txt says, of the crlf attribute: Set:: Setting the `crlf` attribute on a path is meant to mark the path as a "text" file. 'core.autocrlf' conversion takes place without guessing the content type by inspection. That is to say that the crlf attribute does not force the file to have CRLF line endings, instead it removes the autocrlf guesswork and forces the file to be treated as text. Then, whatever line ending is defined by the autocrlf setting is applied. However, that is not what convert.c was doing. The conversion to CRLF was being skipped in crlf_to_worktree() when the following condition was true: action == CRLF_GUESS && auto_crlf <= 0 That is to say conversion took place when not in guess mode (crlf attribute not specified) or core.autocrlf set to true. This was wrong. It meant that the crlf attribute being on for a given file _forced_ CRLF conversion, when actually it should force the file to be treated as text, and converted accordingly. The real test should simply be auto_crlf <= 0 That is to say, if core.autocrlf is falsei (or input), conversion from LF to CRLF is never done. When core.autocrlf is true, conversion from LF to CRLF is done only when in CRLF_GUESS (and the guess is "text"), or CRLF_TEXT mode. Similarly for crlf_to_worktree(), if core.autocrlf is false, no conversion should _ever_ take place. In reality it was only not taking place if core.autocrlf was false _and_ the crlf attribute was unspecified. Signed-off-by: Andy Parkins <andyparkins@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'symlinks.c')
0 files changed, 0 insertions, 0 deletions