After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 587970 - Make git repository LF only for the benefit of Windows clients
Make git repository LF only for the benefit of Windows clients
Status: RESOLVED WONTFIX
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Windows
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-07-07 13:21 UTC by Philip Jägenstedt
Modified: 2009-12-22 09:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
zipped for size (73.11 KB, application/octet-stream)
2009-07-07 13:23 UTC, Philip Jägenstedt
Details

Description Philip Jägenstedt 2009-07-07 13:21:51 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.
Comment 1 Philip Jägenstedt 2009-07-07 13:23:43 UTC
Created attachment 137967 [details]
zipped for size
Comment 2 Philip Jägenstedt 2009-07-07 20:31:30 UTC
When I say file endings I of course mean line endings.
Comment 3 Wim Taymans 2009-12-11 17:26:05 UTC
I don't get the problem. Why would you want to convert anything at all?
Comment 4 LRN 2009-12-12 05:25:25 UTC
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).
Comment 5 Philip Jägenstedt 2009-12-21 11:37:29 UTC
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).
Comment 6 LRN 2009-12-21 18:38:36 UTC
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
Comment 7 Philip Jägenstedt 2009-12-22 09:22:21 UTC
OK, I guess there is no good solution, closing as WONTFIX and will continue to work around locally.