Subject: Re: CRLF problems with Git on Win32

From: Gregory Jefferis <[email-masked]>
Date: Fri, 11 Jan 2008 19:00:40 +0000

Sticking my head above the parapet again ...

On 11/1/08 16:28, "Steffen Prohaska" <[email-masked]> wrote:

> I don't think the CRLF problem is a Windows vs. Unix discussion.
Agreed.
> In my view, the discussion is wether git will have real cross-
> platform support as its default or not.  The current default is
> sane for native Unix or native Windows projects.  For cross-
Absolutely
> platform projects the default needs to be changed in the way
> described above.  Git needs to ensure that CRLF never enters the
> repository for text files.

LF only repositories are model that everyone is tending towards but I feel
that there are (sane) people out there who would sometimes like to have CRLF
files in the repository and do cross-platform development (I would
developing on a Mac for a Windows originated Win/Mac project or if I were
keeping vendor source code in a tree).  In spite of the plethora of autocrlf
variants so far there is still none that on unix would give you LF->CRLF on
check in and CRLF->LF on checkout!  This should be perfectly compatible with
git's internals and I think it should be possible to allow this without
breaking anything for other situations.  One solution, which would have
other uses, would be to allow checkin conversion to a specified line ending
and checkout conversion to platform line ending as separately configurable
options.

If this seems outrageous then it should be made perfectly clear that the git
project strongly discourages CRLF text files in cross-platform repositories,
that to prevent CRLF creep we disallow them by default even in the privacy
of your own OS (if it's Windows) and that if you want to do this you're on
your own mate.  But I think that would be a shame, inflexible and definitely
not PC ;-)

> If you did not set autocrlf=true,
> copying source code from Windows to Unix would not be supported.
> But as you earlier mentioned, this seems to be a common
> operation and I am observing the same.  So I recommend
> autocrlf=input on Unix if you plan to ever go cross-platform.

For me this is kind of the mathematician vs the engineer.  I think Steffen
is logically correct in saying that autocrlf=input on unix is the direct
orthologue of autocrlf=true on windows and I dislike the idea that git
should show logically different behaviour on different platforms.  However I
think Linus's cost/benefit analysis is right: CRLF files appear infrequently
on unix system and often as not it's because someone specifically wants them
to stay that way.

So I think autocrlf=input is a useful option but not a necessary default on
unix.