-
Notifications
You must be signed in to change notification settings - Fork 2
rustfmt section might cause issues with git's autocrlf
#4
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
Comments
Maybe this isn't so bad because git still commits the files with |
By default, this is true (for files Git recognizes as text, i.e. no NUL bytes). And I think While running
|
I've yet to see an editor on Windows (other than Notepad) that messes up when a file has This is an issue when test files rely on the bytes of a line ending: rust-lang/rust-analyzer#14 In that issue the tests were checking the String output of running a function against the contents of a file, and the The even better solution would have been to tell Git not to mess with the newlines for those files so certain input files could test behavior when the program was fed |
We had an issue on Cobalt where rustfmt, changed all the CRLF to LF, changing unchanged file EOL and so they will appear as modified even if we didn't touch them. |
OK, so after paying attention for a while, here's my observations:
I think that the best cost-benefit solution is to advise including an |
rustfmt's default newline style is
unix
.For people using git's
autocrlf
, this will cause problems. They'll checkout the code with crlf, and rustfmt will change it to lf and things might get sad.cobalt is where this was first notice.
Two options
rustfmt.tonl
.editorconfig
.gitattributes
The text was updated successfully, but these errors were encountered: