DOS line endings makes applying patches on Linux really hard

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Post Reply
User avatar
Kunda1
Veteran
Posts: 13443
Joined: Thu Jan 05, 2017 9:03 pm

DOS line endings makes applying patches on Linux really hard

Post by Kunda1 »

issue #1352 from 2014
Do we want to document the @shoogen workaround ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
sgrogan
Veteran
Posts: 6501
Joined: Wed Oct 22, 2014 5:02 pm

Re: DOS line endings makes applying patches on Linux really hard

Post by sgrogan »

Related forum topic: viewtopic.php?t=15443
"fight the good fight"
User avatar
kkremitzki
Veteran
Posts: 2447
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: DOS line endings makes applying patches on Linux really hard

Post by kkremitzki »

What is the workaround exactly? Removing Windows line endings on files as they're touched/as needed by package maintainers?
IMHO adding a single commit to our repo that will remove all Carriage Returns has some drawbacks.
The most important is that it will render the "git blame" command useless and that will make the repo bigger.
Wouldn't this flag from man git-blame address that?

Code: Select all

       -w
           Ignore whitespace when comparing the parent’s version and the child’s to find where the lines came from.
IMO getting rid of Windows line endings piecemeal is not a great solution. You still end up with the same issue of a big commit making the revision history less useful. The alternative is a history-rewriting change that will mess up people's cloned repos, forks, etc. This will have some pain, but so does ripping off a bandaid. There are tools specifically for this, see git-filter-branch: https://git-scm.com/docs/git-filter-branch

The number of people who are actively working off & contributing from cloned repos is probably pretty manageable, and as long as a clear path for getting through it (arrived by testing, which I can help with) is included with the announcement that it's going to happen, it should be fine.

I'm not sure what runtime path issues jobermayr is referring to, but other concerns like conforming to the filesystem hierarchy and mixed line endings are valid and I think if they are reasonably fixable they should be. (BTW there's 1.34 million hits for "mixed line endings issues" on Google for me.)
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
User avatar
Kunda1
Veteran
Posts: 13443
Joined: Thu Jan 05, 2017 9:03 pm

Re: DOS line endings makes applying patches on Linux really hard

Post by Kunda1 »

Revisiting this issue (now issue #5578) in lieu of issue #6497. Since 6497 is pretty invasive and 5578 is super invasive...would now be a good time to execute them both?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
StefanBruens
Posts: 22
Joined: Sun Nov 29, 2020 5:30 am

Re: DOS line endings makes applying patches on Linux really hard

Post by StefanBruens »

Use git blame --ignore-rev/--ignore-revs-file to keep git blame sane? Common naming for the revs file is .git-blame-ignore-revs.

See e.g. https://www.moxio.com/blog/43/ignoring- ... -git-blame
User avatar
Kunda1
Veteran
Posts: 13443
Joined: Thu Jan 05, 2017 9:03 pm

Re: DOS line endings makes applying patches on Linux really hard

Post by Kunda1 »

Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
adrianinsaval
Veteran
Posts: 5414
Joined: Thu Apr 05, 2018 5:15 pm

Re: DOS line endings makes applying patches on Linux really hard

Post by adrianinsaval »

Kunda1 wrote: Mon Mar 21, 2022 10:08 pm Revisiting this issue (now issue #5578) in lieu of issue #6497. Since 6497 is pretty invasive and 5578 is super invasive...would now be a good time to execute them both?
Another possibility is to rewrite history as was mentioned and force push, perhaps at the same time as yorik's proposed nuking of the big help files. Probably best to do that kind of stuff after toponaming merge because that's as huuge portion of code that would have to be probably painfully rebased.
User avatar
chennes
Veteran
Posts: 3678
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: DOS line endings makes applying patches on Linux really hard

Post by chennes »

Good news -- GitHub now has support for the ignore file in public beta: https://docs.github.com/en/repositories ... blame-view
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Post Reply