Open KarlOfDuty opened 11 months ago
I don't see any issue with changing line endings since there hasn't been issues with builds.
Again, this doesn't change anything. This just sets the config to what we are already using.
I don't see any issue with changing line endings since there hasn't been issues with builds.
There is a potential issue. On linux git normalizes line endings to LF, so having editorconfig set to CRLF can cause all line endings to be changed by the IDE. However depending on the git config there might be a similar situation on windows when we set editorconfig to LF.
I'm still waiting for @MichalPetryka opinion, however it might be a better idea to change that in repo git config as well or don't set line ending in editorconfig at all, because git should normalize it anyway.
We've decided that it might be a better idea to force cloning as CRLF in .gitattributes
and to normalize them in the repo instead.
Why not just use LF...?
Why not just use LF...?
Visual Studio always uses CRLF and some other Windows tooling does too.
LF should always work regardless of platform, CRLF will not. And Visual studio doesnt care about your line endings, we use exclusively LF at work and VS has never had any issues with that.
CRLF will not
And CRLF works everywhere too if you use normal tooling.
By default, I believe git can automatically convert line endings but I'm probably entirely wrong.
But what's the point in the first place?
By default, I believe git can automatically convert line endings but I'm probably entirely wrong.
But what's the point in the first place?
That conversion is the entire point of this discussion. By default git converts it to LF on Linux and to either LF or CRLF depending on config on Windows. If the IDE uses CRLF and git converts to LF (or vice versa) you end with ton of automatically made changes by the IDE.
LF should always work regardless of platform, CRLF will not. And Visual studio doesnt care about your line endings, we use exclusively LF at work and VS has never had any issues with that.
There are windows tools that don't support LF. Even notepad (in a slightly older version, still commonly found) is a good example of that. I don't know a tool on linux that doesn't support CRLF (probably because CRLF contains LF, which is the default linux line ending).
Even what's happening on my PC is the perfect example. For me git autoconverts line endings to CRLF and when I changed the .editorconfig as you suggested and did a code cleanup in my IDE I ended with every line of code being changed. Just as you did on linux.
All files in the repo have LF line endings but the editorconfig is set to CR/LF, I fix.