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

EOL conversion nits

From
Jay Soffian <jaysoffian@gmail.com>
Date
Mar 19, 2011, 23:10 UTC
Message-ID
<AANLkTimML1Q-2Eyy=F_y+Z0qy6VrnqtwCUQN-23nuPD8@mail.gmail.com>
Create a repo with a single DOS EOL file:
  git init foo && cd foo &&
  printf 'foo\r\nbar\r\n' > foobar &&
  git add foobar &&
  git commit -m foobar
Normalize the repo:
  echo 'foobar eol=lf' > .gitattributes &&
  rm .git/index && git reset
  Unstaged changes after reset:
  M	foobar
Commit the changes:
  $ git add .gitattributes foobar
  warning: CRLF will be replaced by LF in foobar.
  The file will have its original line endings in your working directory.
  $ git commit -m normalize
  warning: CRLF will be replaced by LF in foobar.
  The file will have its original line endings in your working directory.
  [master f86ff53] normalize
  warning: CRLF will be replaced by LF in foobar.
  The file will have its original line endings in your working directory.
   2 files changed, 3 insertions(+), 2 deletions(-)
   create mode 100644 .gitattributes
So, there's a few issues here:
1. Why is git warning me three times about the EOL conversion?
Shouldn't once, on commit, be sufficient?
2. Shouldn't the message use "working tree", not "working directory"?
3. The git attributes help doesn't say how to convert the line endings
in the working tree, which I guess is:
  $ rm .git/index && git reset --hard
4. I wonder why git's keeping the original line endings in the working
tree post-normalization, but minimally, I think it should provide a
friendlier way to update the working tree line endings to match what
you'd get from a fresh checkout, honoring whatever your EOL settings
are.
Thoughts?
j.
Message 1 of 1 in “EOL conversion nits”
  1. Jay SoffianMar 19, 2011

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.