Line endings
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Line endings
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
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
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Line endings
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?
Re: Line endings
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...
Re: Line endings
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.But it's only cosmetic, no? I've never seen any system have problems with that...
Re: Line endings
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.
- tanderson69
- Veteran
- Posts: 1626
- Joined: Thu Feb 18, 2010 1:07 am
Re: Line endings
git hub has some good information. notice platform choice at the top.
https://help.github.com/articles/dealin ... form-linux
https://help.github.com/articles/dealin ... form-linux
Re: Line endings
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)
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
Would adding some options to .gitattributes to enforce normalized line endings be a problem?
Cheers,
Mateusz
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
I'm on Linux
Code: Select all
$ git config -l
core.autocrlf=input
Cheers,
Mateusz
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Line endings
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.
So, it probably makes sense to at least get rid of mixed line endings within one file.
Re: Line endings
I personally think it sounds good, the mixed-line-ending files can be a bit annoying. -Ian-f3nix wrote:Would adding some options to .gitattributes to enforce normalized line endings be a problem?