Use LF everywhere, not just in the repository - #4
Merged
Merged
Conversation
Git stores text as LF whatever the attributes say, so CRLF in the working tree was only ever a conversion layer between the stored form and the one on disk. Nothing here needs it: the repository is C#, YAML, Markdown, JSON and one PowerShell script, and every tool that reads them is content with LF. The only files that genuinely require CRLF are .bat and .cmd, which cmd.exe mis-parses around labels and goto when they are LF-only; there are none, and .gitattributes now carries a rule so that a future one is safe. Two representations meant two chances to be wrong, and both were taken during this project: files written by tooling repeatedly came out with the wrong endings, and a check for the wrong state reported a problem that did not exist. One representation removes the category. The diff is two files. Because the index was already LF, changing eol=crlf to eol=lf alters only what checkout writes, so there is no content change to any source file and no need for a blame-ignore revision. The working tree was converted in place to match what a fresh clone now produces. The explicit eol=lf rather than a bare text=auto is deliberate: text=auto alone gives each platform its native ending, so a Windows clone would get CRLF and fail the end_of_line = lf check that CI gates on, for a reason invisible in the diff. Claude-Session: https://claude.ai/code/session_01TJ8i7jHmkUjVCjVccLp6Hf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
.editorconfigand.gitattributesswitch from CRLF to LF in the working tree. Git already stored LF, so CRLF existed only on disk — a conversion layer that nothing in this repository needs.The diff is two files
Because the index was already LF, changing
eol=crlftoeol=lfalters only what checkout writes. No source file changes content, so there is no whole-repo reformat and no.git-blame-ignore-revsis needed.git diff --numstatconfirms exactly two files differ.The working tree was converted in place so local builds match what a fresh clone now produces.
Why not a bare
text=autotext=autoalone gives each platform its native ending, so a Windows clone would get CRLF and fail theend_of_line = lfcheck that CI gates on — for a reason invisible in the diff. The expliciteol=lfforces LF on every platform.The one exception, kept for the future
cmd.exemis-parses LF-only batch files around labels andgoto. There are no.bator.cmdfiles here, but.gitattributesnow pins them to CRLF so a future one is safe.Verification
dotnet format --verify-no-changesclean under the new rule, 154 tests pass, library and sample both build warning-free in CI mode, and the changelog extraction script still runs.https://claude.ai/code/session_01TJ8i7jHmkUjVCjVccLp6Hf