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

core.safecrlf warning is confusing[improvement suggestion?]

From
Vladimir Nikishkin <lockywolf@gmail.com>
Date
Nov 21, 2017, 05:18 UTC
Message-ID
<CA+A2iZaLZCMvyb3nbcn=ofVGAPeW2_wRhjOeRRu5q01LuV++Gw@mail.gmail.com>
Hello, everyone.
I have the following question.
So I have a fresh git repository after git init, on Windows.
core.autocrlf is true explicitly, and core.safecrlf is true implicitly.

I want to have LF line endings in the repository and CRLF endings in the working copy. (Because I use windows-exclusive tools to develop.)

But for start I have my code with LF endings, because I got it from a fellow developer, who develops on UNIX, with LF line endings.

What I expect git to do: Commit files as is (LF), keep my files in the working directory with LF, but after issuing 'git checkout master' have them converted to CRLF (since this is a checkout procedure).

So I put the source in the working directory and tell git to make
git diff --stat
and I see the (ambiguous) warnings:

'warning: LF will be replaced by CRLF in filename.m. The file will have its original line endings in you working directory.'

How I read them: "even though you have core.autocrlf=true, LF will be replaced by CRLF and the repository will store CRLF files. However, after you checkout them again, the CRLFs will be converted back to LF(because the files will have original line endings in the working directory.)"

 I feel like it's the opposite of what is actually happening.
So, would it make sense to change the warning message to? :

'warning: When you next checkout this commit, your code will have CRLF line endings. However, right now your files will not be altered.'

-- 
Yours sincerely, Vladimir Nikishkin
Next: Junio C Hamano
Message 1 of 6 in “core.safecrlf warning is confusing[improvement suggestion?]”
  1. Vladimir NikishkinNov 21, 2017
  2. Junio C HamanoNov 21, 2017
  3. Junio C HamanoNov 21, 2017
  4. Torsten BögershausenNov 21, 2017
  5. Junio C HamanoNov 22, 2017
  6. Torsten BögershausenNov 22, 2017

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.