Line endings

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
f3nix
Posts: 346
Joined: Sat May 30, 2015 11:58 am

Line endings

Post by f3nix »

Hi,
are there any plans to normalize line endings in the repository?

As of today there are some files that have CRLF, some files that have LF and some are mixed CRLF and LF.

Cheers,
Mateusz
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Line endings

Post by DeepSOIC »

With development tools I use (Qt Creator, Programmer's notepad), I don't notice anything. Modern tools seem to digest any line endings pretty well. So, does it really matter?
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Line endings

Post by yorik »

This is due to some people developing on windows, others on linux... I think if we would unify it, quickly after, "wrong" line endings would begin to appear again, so it's not much use. But it's only cosmetic, no? I've never seen any system have problems with that...
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Line endings

Post by wmayer »

But it's only cosmetic, no? I've never seen any system have problems with that...
It depends on some editors what they do with a file with mixed line endings. Some tend to unify all line endings to UNIX style (e.g. qt creator used to do this) and this makes it very hard to review changes.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Line endings

Post by jmaustpc »

I thought we had a instruction somewhere in the wiki to standardise by using Unix style line endings? But I can't find it now. I think we discussed this a long time ago in the forum but I have not found that either. I think some one said you can get git to ignore line ending changes but perhaps I am getting confused with white spaces.
User avatar
tanderson69
Veteran
Posts: 1626
Joined: Thu Feb 18, 2010 1:07 am

Re: Line endings

Post by tanderson69 »

git hub has some good information. notice platform choice at the top.
https://help.github.com/articles/dealin ... form-linux
User avatar
f3nix
Posts: 346
Joined: Sat May 30, 2015 11:58 am

Re: Line endings

Post by f3nix »

Hi,
the biggest problem I have is with the mixed line endings. I'm using QtCreator.

E.g.
I've made some changes to src/Gui/FileDialog.cpp
When I execute git diff it does not only show my changes but also the eol changes. I think QtCreator converts the line endings to the ones that are used the most in the file (remember this is a mixed CRLF/LF file). In this example to CRLF.

So I have to use a trick by @tanderson69 shared in another thread (Git trick)

Code: Select all

git diff -w --no-color | git apply --cached --ignore-whitespace
To create a nice looking patch and avoid "Wall of Pink" (You're just another carriage return line feed in the wall)

I'm on Linux

Code: Select all

$ git config -l
core.autocrlf=input
Would adding some options to .gitattributes to enforce normalized line endings be a problem?

Cheers,
Mateusz
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Line endings

Post by DeepSOIC »

Ah, now I recall it happened to me. I did a small change, but got a whole-file diff. That was a bit of pain, and I didn't even know it was caused by line endings change.
So, it probably makes sense to at least get rid of mixed line endings within one file.
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Line endings

Post by ian.rees »

f3nix wrote:Would adding some options to .gitattributes to enforce normalized line endings be a problem?
I personally think it sounds good, the mixed-line-ending files can be a bit annoying. -Ian-
Post Reply