GNOME Bugzilla – Bug 587970
Make git repository LF only for the benefit of Windows clients
Last modified: 2009-12-22 09:22:21 UTC
The git repository doesn't care about file endings, but there is a core.autocrlf flag which is set by default on windows. This converts all file endings to CRLF on checkout and back to LF on commit. However, it breaks completely when there are mixed CRLF/LF in the repository. You get bogus changes which means you can't switch branches, you can't see actual changes amount all the CRLF noise, etc. I've tried to find advice about this, but all I've heard is "make the repository LF and use core.autocrlf". Suggest simply converting all files to LF to be rid of the problem. Attaching the (huge) diffs from a fresh checkout of the repositories I've found that need fixing. Perhaps a script could do it as well, but the diffs are there if you need them.
Created attachment 137967 [details] zipped for size
When I say file endings I of course mean line endings.
I don't get the problem. Why would you want to convert anything at all?
Set core.autocrlf = false, then re-clone the repository (this IS necessary!). autocrlf = false will prevent Git from mangling any data you pull and any data you commit. Only use LF-abiding text editors on repository files afterward (again, because Git won't fix lineendings for you, so if your text editor inserts CRLF where it shouldn't, your commits will have mixed LF/CRLF lineendings, making GStreamer developers sad). The fact that MSysGit leaves autocrlf=true by default is disturbing, considering that it is built around MSys, which handles LF-only lineendings just fine. At the moment only a few files in GStreamer repositories do have CRLF lineendings. They are like that on purpose, because they are intended to be used by MSVC (MSVC dislikes LF-only lineendings).
Visual Studio will mess up LF-endings. I could just not use VS, but when debugging Windows-specific problems that's not really an option. I'd be happy to hear how others handle this (with or without autocrlf).
You could try core.autocrlf=input Also try to toy with core.safecrlf (not sure what it does) Other than that i see 2 solutions, both flawed: 1) Convert repositories to LF-only (as proposed) - assume that Windows users will have core.autocrlf=true 2) Keep repositories as they are - assume that Windows users will have core.autocrlf=false and a text editor fully supporting LF lineendings P.S. MSVS supports LF lineendings, google for it, and also try read http://msdn.microsoft.com/en-us/library/w11571b4%28VS.80%29.aspx
OK, I guess there is no good solution, closing as WONTFIX and will continue to work around locally.