I have a .gitattributes file in my repository that looks like this
* text=auto
*.txt text
I have unset core.autocrlf in the repository, global, and system settings. My understanding, based on the documentation for gitattributes, is that all files in the repository whose names end with .txt should be checked out with the native line endings. What I'm seeing, though, is that the .txt files always have LF for line endings, even on Windows. Given this configuration, why aren't the line endings CRLF on Windows?
The problem is that there is a bug in the handling of core.eol. Documentation for gitattributes says that if it is unset then native will be used, which should default to the proper line endings for your system (CRLF for Windows, LF for unix), however leaving core.eol unset or setting it to native on my system always results in LF for line endings. The answer, then, is to set core.eol to crlf on Windows explicitly. The comments at http://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/ led me to this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With