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

git: checkout cs files with crlf #1372

Merged
merged 2 commits into from
Apr 17, 2024
Merged

git: checkout cs files with crlf #1372

merged 2 commits into from
Apr 17, 2024

Conversation

mus65
Copy link
Contributor

@mus65 mus65 commented Apr 7, 2024

Currently, when you clone the repository on a Linux machine, all cs files have the wrong line endings. The .editorconfig file enforces crlf, but git will checkout the files with the default OS file encoding by default (lf).

This causes a dotnet format whitespace --verify-no-changes to complain about the line endings on a fresh working copy.

Tell git to checkout *.cs files with crlf to fix this. Note that existing linux working copies would need to run the following to fix the newlines after pulling in this change: git rm -rf --cached . && git reset --hard HEAD.

I noticed this while looking into enforcing formatting in CI, but that's for a separate PR.

@Rob-Hague
Copy link
Collaborator

Fine for me either way, just wondering if it makes more sense to stop enforcing crlf in the .editorconfig? i.e. delete this line instead

end_of_line = crlf

For reference, the dotnet/runtime .editorconfig and .gitattributes:

https://github.com/dotnet/runtime/blob/main/.editorconfig
https://github.com/dotnet/runtime/blob/main/.gitattributes

instead of forcing crlf checkout in git
@mus65
Copy link
Contributor Author

mus65 commented Apr 8, 2024

Yeah, I think that makes even more sense, thanks. Pushed.

@Rob-Hague Rob-Hague merged commit 0fb3871 into sshnet:develop Apr 17, 2024
1 check passed
@mus65 mus65 deleted the fixgiteol branch September 14, 2024 09:30
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.

3 participants