git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Pēteris Kļaviņš
Message 6 of 6 in “Bug in EOL conversion?”
  1. Stefan NorgrenJan 23, 2013
  2. Philip OakleyJan 23, 2013
  3. Erik Faye-LundJan 23, 2013
  4. Philip OakleyJan 23, 2013
  5. Pēteris KļaviņšJan 23, 2013
  6. Thomas RastJan 23, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.