Re: Bug in EOL conversion?
From: Thomas Rast <hidden>
Date: 2016-06-15 22:55:52
Stefan Norgren [off-list ref] writes:
$ git add * warning: LF will be replaced by CRLF in withlf.txt. The file will have its original line endings in your working directory.
[...]
$ ls -la total 10 d---------+ 1 Stefan None 0 Jan 23 02:12 . d---------+ 1 Stefan None 0 Jan 23 02:10 .. d---------+ 1 Stefan None 0 Jan 23 02:22 .git ----------+ 1 Stefan None 3 Jan 23 01:55 withcrlf.txt ----------+ 1 Stefan None 2 Jan 23 01:55 withlf.txt
[...]
$ git ls-tree -l HEAD withcrlf.txt 100644 blob d00491fd7e5bb6fa28c517a0bb32b8b506539d4d 2 withcrlf.txt $ git ls-tree -l HEAD withlf.txt 100644 blob d00491fd7e5bb6fa28c517a0bb32b8b506539d4d 2 withlf.txt
Isn't that what would be expected? It's a combination of
- the canonical representation of a newline is LF, so the repository
stores LF
- with safecrlf, checkout converts LF->CRLF and add converts CRLF->LF
So from the user's POV, running
git add withlf.txt
rm withlf.txt
git checkout -- withlf.txt
would appear to replace LF with CRLF in the worktree. That's what the
message says.
--
Thomas Rast
trast@{inf,student}.ethz.ch