On Mon, Jan 24, 2022 at 01:13:18AM -0800, Matthias Urlichs wrote: > Hello, > apparently git can do files that are stored with LF but checked out as CRLF > quite easily. > > However, is there a reasonable way to do things the other way 'round, i.e. > store the file with CRLF but check them out with LF on Linux?
Yes: setting both core.autocrlf to "false" and core.eol to "crlf" should defeat Git's EOL normalizations. You might also set core.safecrlf to "false" as well - just to avoid the possibility of another smart EOL normalization algoritm kicking in. To demonstrate: --------------------------------8<-------------------------------- crlf$ git config --local --list core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true core.autocrlf=false core.safecrlf=false core.eol=crlf crlf$ unix2dos >test.txt This is a text. ^D crlf$ hexdump test.txt 0000000 6854 7369 6920 0d73 610a 7420 7865 2e74 0000010 0a0d 0a0d 0000014 crlf$ git add test.txt crlf$ git commit -m 'add test.txt' [master (root-commit) bd28910] add test.txt 1 file changed, 3 insertions(+) create mode 100644 test.txt crlf$ git ls-tree -r HEAD 100644 blob e69c782e16209f66ea571c1b318e3c797cd31e38 test.txt crlf$ git cat-file blob e69c782e16209f66ea571c1b318e3c797cd31e38|hexdump 0000000 6854 7369 6920 0d73 610a 7420 7865 2e74 0000010 0a0d 0a0d 0000014 --------------------------------8<-------------------------------- Still, your question smells like an "XY problem" to me; what actual problem are you trying to solve? Or is it plain curiosity? ;-) -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/20220124095311.eiavkvtnzcvjpv7u%40carbon.
