PR 2730, "Fix" line-endings

Post here if you have re-based and finalised code to integrate into master, which was discussed, agreed to and tested in other forums. You can also submit your PR directly on github.
User avatar
bernd
Posts: 9037
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: PR 2730, "Fix" line-endings

Post by bernd » Fri Dec 06, 2019 9:44 am

We might do not use

Code: Select all

 * text=auto
at all ...

https://github.com/berndhahnebach/FreeC ... ributes#L3

Since we declare all text file types manually we do not need it IMHO. It would be much more save because than only the files explizit declared as text would be normalized by git. If we omit the auto line we even would not need to declare the binary files.

Any git expert around?

ezzieyguywuf
Posts: 637
Joined: Tue May 19, 2015 1:11 am

Re: PR 2730, "Fix" line-endings

Post by ezzieyguywuf » Sat Dec 07, 2019 5:17 am

Incidentally, it looks like gitlab does have an option to ignore whitspace in diffs...in the gui.
2019-12-07-001005_1440x900_scrot.png
2019-12-07-001005_1440x900_scrot.png (75.59 KiB) Viewed 576 times

triplus
Posts: 9136
Joined: Mon Dec 12, 2011 4:45 pm

Re: PR 2730, "Fix" line-endings

Post by triplus » Tue Dec 10, 2019 8:46 pm

ezzieyguywuf wrote:
Tue Dec 03, 2019 2:31 pm
include the necessary .gitattributes info to ensure that anyone using our git repo in the future will have the appropriate git settings to prevent future issues.
How about doing just that for now? New files and existing modified files therefore to always get desired line endings. As for the rest, not to worry about it for now? And therefore for files, where line endings get corrected, to use a -w option in the future (git blame).

triplus
Posts: 9136
Joined: Mon Dec 12, 2011 4:45 pm

Re: PR 2730, "Fix" line-endings

Post by triplus » Tue Dec 10, 2019 9:18 pm

Reading this:
After you've set the core.autocrlf option and committed a .gitattributes file, you may find that Git wants to commit files that you have not modified. At this point, Git is eager to change the line endings of every file for you.
https://help.github.com/en/github/using ... ne-endings

Didn't test it locally, but once we would introduce .gitattributes file, all (existing) files would automatically be checked anyway, and line-endings to be changed accordingly to the setting?

User avatar
bernd
Posts: 9037
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: PR 2730, "Fix" line-endings

Post by bernd » Tue Dec 10, 2019 10:06 pm

triplus wrote:
Tue Dec 10, 2019 8:46 pm
ezzieyguywuf wrote:
Tue Dec 03, 2019 2:31 pm
include the necessary .gitattributes info to ensure that anyone using our git repo in the future will have the appropriate git settings to prevent future issues.
How about doing just that for now? New files and existing modified files therefore to always get desired line endings. As for the rest, not to worry about it for now? And therefore for files, where line endings get corrected, to use a -w option in the future (git blame).
we will for FEM and Material ATM and than see how it does work ... see PR https://github.com/FreeCAD/FreeCAD/pull/2757

User avatar
looo
Posts: 3113
Joined: Mon Nov 11, 2013 5:29 pm

Re: PR 2730, "Fix" line-endings

Post by looo » Wed Dec 11, 2019 8:25 am

Seems like an agreement was found regarding handling of line endings. It would be nice to have a proposal/summary to not have to read this full topic and make it easier for new developers to understand there problem/solution.
please help with my conda-packaging efforts: https://liberapay.com/looooo/
minimalistic blog: https://looooo.github.io/mini-blog/

triplus
Posts: 9136
Joined: Mon Dec 12, 2011 4:45 pm

Re: PR 2730, "Fix" line-endings

Post by triplus » Thu Dec 12, 2019 9:52 pm

bernd wrote:
Tue Dec 10, 2019 10:06 pm
we will for FEM and Material ATM and than see how it does work ... see PR https://github.com/FreeCAD/FreeCAD/pull/2757
OK, lets see how it will behave, have seen it got merged. After a while i guess @ezzieyguywuf should prepare a PR, moving the .gitattributes file to root folder? As there seems to be a general consensus, this should be done. Potential cons are therefore manageable (usage of -w option, when it comes to git blame command).
looo wrote:
Wed Dec 11, 2019 8:25 am
Seems like an agreement was found regarding handling of line endings. It would be nice to have a proposal/summary to not have to read this full topic and make it easier for new developers to understand there problem/solution.
We i guess could, but the way i understand it .gitattributes file will enforce (Unix) line endings, once moved to the root folder. Therefore not much one needs to understand anymore.

P.S. Unless it will turn out, there is still some "vector" open, that can introduce undesired line endings in FreeCAD Git repository.

User avatar
bernd
Posts: 9037
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: PR 2730, "Fix" line-endings

Post by bernd » Fri Dec 13, 2019 7:20 am

triplus wrote:
Thu Dec 12, 2019 9:52 pm
bernd wrote:
Tue Dec 10, 2019 10:06 pm
we will for FEM and Material ATM and than see how it does work ... see PR https://github.com/FreeCAD/FreeCAD/pull/2757
OK, lets see how it will behave, have seen it got merged. After a while i guess @ezzieyguywuf should prepare a PR, moving the .gitattributes file to root folder?
This is not a good idea IMHO, FEM and Material have used LF line endings for years already. Thus it was just another step in developement of these modules. Other modules might use windows line endings. For them it would be a huge step. Rebasing gets more difficault afterwards. If one knows how to do it with changed line endings, it is simple. If one does not know how to do rebasing with changed line endings it will make him crazy.

My suggestion would be to go step by step, module by module. The module maintainer has to fix upcoming problems, so he should decide if he goes for this change.

But the change is for sure a step in the right direction, because if done, line ending problems will solved forever :D (hopefully :shock: )

User avatar
bernd
Posts: 9037
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: PR 2730, "Fix" line-endings

Post by bernd » Tue Dec 17, 2019 10:58 pm

I had a closer look which modules could use the gitattributes file too. Most modules have dozens of windwos line endings files. As stated before this could lead to huge rebase problems.

But I found three modules on which it would be worth IMHO. The one of Yorik. Means AddonManager, Arch and Draft. Since he does develop on Linux too, his files have LF line endings. Thus only a few files would be converted.

PR made https://github.com/FreeCAD/FreeCAD/pull/2789
yorik wrote: ping

User avatar
bernd
Posts: 9037
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: PR 2730, "Fix" line-endings

Post by bernd » Thu Dec 19, 2019 7:45 am

AddonManager, Arch, Draft, Fem and Material are normalized to LF and secured by gitattribute file

Post Reply