Thread (12 messages) flat view 12 messages, 6 authors, 2016-06-15

Re: CRLF, LF ... CR ?

From: Jeff King <hidden>
Date: 2016-06-15 22:54:44

On Thu, Sep 13, 2012 at 11:34:50AM -0400, Drew Northup wrote:
quoted
I've read that git supports two different line endings; either CRLF or LF, but it does not support CR.
Would it make sense to add support for CR (if so, I hereby request it as a new feature) ?
Even if Git can't do CRLF/LF translation on a file it will still store
and track the content of it it just fine. In fact you probably want
translation completely disabled in this case. 
Yeah. If the files always should just have CR, then just don't ask git
to do any translation (by not setting the "text" attribute, or even
setting "-text" if you have something like autocrlf turned on globally),
and it will preserve the bytes exactly. I suspect diffs will look nasty
because we won't interpret CR as a line-ending, though.

Do the files actually need line-by-line diffing and merging? If not,
then you are fine.

If so, then it would probably be nice to store them with a canonical LF
in the repository, but convert to CR on checkout. Git can't do that
internally, but you could define clean/smudge filters to do so (see the
section in "git help attributes" on "Checking-out and checking-in";
specifically the "filter" subsection).

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help