Make Git EOL consistent with .editorconfig (LF) #2230
Closed
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.
This was resubmitted as #2231.
What was here before
What's In This PR
The
.editorconfig
file setsend_of_line = lf
, but.gitattributes
does not. This leaves Git to behave as per its own configuration or defaults. On Windows, it is very common (and IMO, best practice) to enable theautocrlf
feature to perform EOL normalization, which transforms LF to CRLF on checkout and performs the inverse transformation on commit. For Iosevka, however, the result is that a freshgit clone
consists of files with CRLFs, in contravention of the.editorconfig
.One consequence is that a Windows user following the Docker build instructions can generate a container image whose
build.sh
contains CRLFs, which Bash does not understand. This results in containerized Iosevka builds failing with a rather cryptic error:Another consequence is that tools that understand
.editorconfig
might complain about inconsistent line endings and convert the CRLFs to LFs on save, generating seemingly spurious changes ingit status
.A few Git commands fix this, but an easier way is to ensure that Git checks out using LF regardless of the developer's platform or Git configuration. This PR does that.
An Alternative Way
A slightly more complicated way would be to enable Git EOL normalization everywhere except for the one file that must use LF. Doing so would enable Windows users to use CRLF while everyone else (and the repository itself) remains using LF. This is the choice I make for my own repositories if the build tools support both LF and CRLF. If you'd prefer this, I am happy to change the PR.
.editorconfig
First, remove the line
end_of_line = lf
.Then add:
.gitattributes
Add: