Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed line endings setting in .editorconfig #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KarlOfDuty
Copy link
Contributor

All files in the repo have LF line endings but the editorconfig is set to CR/LF, I fix.

@iamalexrouse
Copy link
Contributor

I don't see any issue with changing line endings since there hasn't been issues with builds.

@KarlOfDuty
Copy link
Contributor Author

Again, this doesn't change anything. This just sets the config to what we are already using.

@zabszk
Copy link
Member

zabszk commented Dec 5, 2023

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.

@zabszk zabszk self-assigned this Dec 5, 2023
@MichalPetryka
Copy link
Contributor

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.

@KarlOfDuty
Copy link
Contributor Author

Why not just use LF...?

@MichalPetryka
Copy link
Contributor

Why not just use LF...?

Visual Studio always uses CRLF and some other Windows tooling does too.

@KarlOfDuty
Copy link
Contributor Author

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.

@MichalPetryka
Copy link
Contributor

VS has never had any issues with that

It does have issues.

@MichalPetryka
Copy link
Contributor

CRLF will not

And CRLF works everywhere too if you use normal tooling.

@iamalexrouse
Copy link
Contributor

iamalexrouse commented Dec 7, 2023

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?

@zabszk
Copy link
Member

zabszk commented Dec 7, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants