Skip to content

Use LF everywhere, not just in the repository - #4

Merged
Menelion merged 1 commit into
masterfrom
switch-to-lf
Sep 8, 2026
Merged

Menelion merged 1 commit into
masterfrom
switch-to-lf

Conversation

@Menelion

@Menelion Menelion commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

.editorconfig and .gitattributes switch 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=crlf to eol=lf alters only what checkout writes. No source file changes content, so there is no whole-repo reformat and no .git-blame-ignore-revs is needed. git diff --numstat confirms 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=auto

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. The explicit eol=lf forces LF on every platform.

The one exception, kept for the future

cmd.exe mis-parses LF-only batch files around labels and goto. There are no .bat or .cmd files here, but .gitattributes now pins them to CRLF so a future one is safe.

Verification

dotnet format --verify-no-changes clean 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

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
@Menelion
Menelion merged commit 79691eb into master Sep 8, 2026
1 check passed
@Menelion
Menelion deleted the switch-to-lf branch September 8, 2026 12:36
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.

1 participant