Thread (33 messages) 33 messages, 13 authors, 2016-08-11

Re: CRLF problems with Git on Win32

flat view

From: Dmitry Potapov <hidden>
Date: 2016-06-15 22:44:03

On Wed, Jan 09, 2008 at 01:52:59PM +0000, Gregory Jefferis wrote:
crlf=safe [i.e. munging CRLFs only if there are no bare LFs] sounds
appealing to me as well because it looks like munging that is always
reversible.  However there could still be problems at checkout.  To be
really safe, it seems to me that it must be 1) reversible in practice and 2)
ALWAYS reversed unless we explicitly ask for no gnuming at checkout.  Why?

Re point (1) to be reversible in practice, we need to know who we've munged.
Otherwise when gnuming blindly at checkout we might damage some innocent
bystander file that only ever had LFs in the first place.
If you work on Windows and you have clrf=safe, you cannot put a text
file that has only LFs, because naked LF is not allowed. If you want
to have naked LF in some file, you have to say that explicitly in
.gitattributes.

If you work on cross platform project, and somebody else put a file with
bare LFs, which is not text though heauristic wrongly detected it as
text then you can remove this file from your working directory, correct
.gitattributes and checkout this file again. The idea of crlf=safe is
that information is never lost. It is always fully reversible, and if
you put something into the repostory, you always get back exactly the
same unless you changed your .gitattributes.
Re (2) well if we happen to munge a file on checkin that is actually binary,
it must be gnumed on the way out otherwise it will be broken for the user.
Of course, it will, because the same heuristic will detect it as text,
and convert it back. So as long as you stay on the same platform and
with the same .gitattributes, you always get back exactly what you
put.

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