Line endings should be LF across repo and not CRLF #10119
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Up to now we've had quite a few issues with users on Windows having their line endings be "CRLF" by default, while Linux users have "LF" line endings by default.
Problem
This can be problematic in the following scenarios where no handling of the issue has been done on the user's side:
make style
, their line endings will switch from LF to CRLF in all files, essentially rewriting the entire fileResolution
The resolution is either to have the user handle that, or to handle that ourselves. Handling it ourselves is simple as it only requires adding a
.gitattributes
file at the root of the repository which will specify the line endings we're looking for, thus this is what this PR is proposing. On the other hand, we had issues handling it on the user side with the proposedgit core.autocrlf
as it seemed to have different results according to the setup.Additionally, if users already have files in
CRLF
mode, then an additional command is required to convert these files toLF
:git add --renormalize .
. I believe this only impacts users that created files previous to this PR, as newly created files will already benefit from the.gitattributes
file.This PR completely reformats two files:
examples/research_projects/bertology/run_prune_gpt.py
andtests/test_modeling_deberta.py
. These files had CRLF line endings, and will now have LF line endings.Further readings:
cc @NielsRogge