Re: mingw, windows, crlf/lf, and git
From: Mark Levedahl <hidden>
Date: 2016-06-15 22:42:54
Linus Torvalds wrote:
On Tue, 13 Feb 2007, Mark Levedahl wrote:quoted
A proper win32 port will accept any of \n, \r\n as valid line endings (add \r to support Mac pre-OSX if anyone cares, I still occasionally see such files), treat any of them as semantically equal, and enforce the user's chosen style (\n or \r\n) on output.The patch I sent out does that, except right now the "autocrlf" flag is just a pure boolean. I could easily make it take a ternary value: - off (normal UNIX semantics - never change anything) - on (turn CRLF->LF on input, turn LF->CRLF on output) - input-only (turn CRLF->LF on input, leave LF alone on output) Linus
Wow, this is an incredible response: I expected I was going to be studying git internals for a while to get to this point. Thank you! The ternary value is definitely useful. As noted elsewhere, most tools on windows are very happy with \n ending, few honor those line endings when files are modified, and fewer still allow the user to specify use of \n for new files. However, cygwin tools in particular are not tolerant of crlf, so for that environment it makes sense to banish crlf and the input-only option is most likely the best default setting there. Mark