Re: Bug in EOL conversion?
- From
Thomas Rast <trast@student.ethz.ch>
- Date
- Jan 23, 2013, 22:46 UTC
- Message-ID
- <87ehhb5xgg.fsf@pctrast.inf.ethz.ch>
- In-Reply-To
- <CANrZfmGXtKcB+i_xhNJELftRc1pC2TJKKhOieHm=5Qkni9OKrA@mail.gmail.com>
Stefan Norgren <stefan.norgren@gmail.com> 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.
[...]
Show 7 quoted lines
> $ 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