Enforce usage of LF line endings

msteiger

Active Member
Contributor
World
Architecture
Logistics
Today, I had to realize (again) that line endings were inconsistent ( thanks Cervator for the hint ). This is basically impossible using git or msysgit, but the git version that comes with eclipse (it's egit which is based on jgit) ignores a few configs (unable to resolve system config which is stored in git installation folder) and the gitattributes file. See

https://bugs.eclipse.org/bugs/show_bug.cgi?id=342372

We could ensure comitting only LF to the repos, if the working dir contained only LF files. And that, in turn, could be verified using CheckStyle (at least for the last line of the file).

Code:
<module name="NewlineAtEndOfFile">
  <property name="lineSeparator" value="lf"/>
</module>
I just enabled it for my workspace and it works as expected. I also changed eclipse config, so new files have automatically LF endings.

Would this change have a negative impact on anyone's workflow or code environment?
 

synopia

Member
Contributor
Architecture
GUI
I always reformat my code before committing. This should be a simple setting in idea.

Just to make sure: Is LF linux or windows style?
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
The way git works for me is the files have crlf in my workspace, but that is transformed to lf on commit. My understanding is that is how git is intended to work? This may mess things up for me, I guess.

Edit: I may be getting tired of living in a world where things working properly is compromised by dodgy eclipse plugins. :/

Would setting up a jenkins job specifically to check for this, and email cervator or I when it occurs so we can sort it out and educate those involved work? I imagine the problem would only crop up once per contributor at most, seems a pity to break preferred Windows behaviour for that.
 

Mike Kienenberger

Active Member
Contributor
Architecture
GUI
I'm also in favor of leaving the default git behavior as crlf for windows and lf for unix, which are automatically converted to lf on commit.
I agree with Immortius that dodgy eclipse plugins should be fixed rather than adjusting everything else :)

A better workaround would be a script/app/exe/plugin for msteiger that he runs in his environment.

Or take a look at "File -> Convert Line Delimiters To... [Windows/Unix]" in Eclipse to convert files individually or as a group.
 

msteiger

Active Member
Contributor
World
Architecture
Logistics
I agree with you guys - we (the eclipse people) wait for a fix for this silly bug for ages now. There is one, but it is stuck in the review-queue.
The checkstyle workaround works fine for me - if you (in particular @mkienenb and other eclipse users) don't have problems with that, we should leave it the way it is.
 

Mike Kienenberger

Active Member
Contributor
Architecture
GUI
I think you are currently the only Windows Eclipse Eclipse-git-plugin user.
I don't use Eclipse under Windows very often, and currently I am doing all of my git operations from the command-line.
I'd really like to get back to using the Team-Synchronize view, but I want to make sure I completely understand git before I trust a module to do it for me, just for the reasons you described with egit
 
Top