Git: text=auto and "warning: LF will be replaced by CRLF"

300 Views Asked by At

This is an example from Override .gitattributes text=auto in Windows:

C:\python-tdl\examples\termbox>git config core.autocrlf
false

C:\python-tdl\examples\termbox>git commit termbox.py
warning: LF will be replaced by CRLF in examples/termbox/termbox.py.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in examples/termbox/termbox.py.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in examples/termbox/termbox.py.
The file will have its original line endings in your working directory.
Aborting commit due to empty commit message.

That other question asks how to override .gitattributes while I would like to know WHY the warning happens.

According to the docs, text=auto does normalization, i.e., changes CRLF -> LF on check in. It shouldn't touch the file in the other direction. In other words, it should behave similarly as if I had core.autocrlf = input.

So what's the warning about? Does Git want to change LF -> CRLF in my working directory? (Which doesn't make sense.) Or is it telling me that LF will be in the repository? (In which case the message reads just wrong, doesn't it?)

0

There are 0 best solutions below