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

The project has mixed line endings, and that's bad #489

Open
AnsisMalins opened this issue Oct 23, 2024 · 4 comments
Open

The project has mixed line endings, and that's bad #489

AnsisMalins opened this issue Oct 23, 2024 · 4 comments

Comments

@AnsisMalins
Copy link
Collaborator

Issue type: Development discussion

Problem or question to be solved

Some files and lines with LF (example: SongLibraryOptionsSceneControl.cs), others end lines with CRLF (example: FileSystemDialogUtils.cs). Visual Studio is unable to consistently switch between different line endings one a per file basis. This causes diffs where the whole file changed. But also, mixed line endings are just plain rude.

Suggested solution/s

Pick one, reformat all files to it, and add an editorconfig rule to enforce it.

Your opinion on the topic

I would go with LF because it's more popular in the open source world, and anyway, Windows will be dead soon. :^)

@achimmihca
Copy link
Collaborator

I agree, mixed line endings are annoying.

I found that Unity creates its auto generated files with \r\n line endings.
Probably on macOS and Linux, Unity auto generates files with \n line endings. Can you confirm this?

Furether, the current custom code generation (e.g. RMessages.cs) just uses \n. We could adjust this.

Note that Git can convert between line endings, see core.autocrlf.
This option is set to true on my system, so I might check out files as \r\n but all files that I commit should use \n.
Weird that some files on your system have a different line ending.

Anyway, I don't have a strong opinion on this, would prefer \n. Feel free to adjust this.

@AnsisMalins
Copy link
Collaborator Author

I do not understand how autocrlf is not mega, giga evil. When I checkout, I expect to receive exactly what's in the repo, byte for byte, and the same when committing. Furthermore, autocrlf breaks any tools that compare files, calculate their hashes, and so on.

@basisbit
Copy link
Member

autocrlf is a standard thing and as far as I know, all projects I contribute do also use it.. @AnsisMalins what git client are you using, that you have any issue with this at all?

@AnsisMalins
Copy link
Collaborator Author

I'm using Git and GitExtensions. If autocrlf is the law then I will obey and turn it on for this repo.

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

No branches or pull requests

3 participants