Skip to content

chore: normalize line endings to LF everywhere#45

Merged
P4suta merged 1 commit into
mainfrom
chore/lf-line-endings
Jul 24, 2026
Merged

chore: normalize line endings to LF everywhere#45
P4suta merged 1 commit into
mainfrom
chore/lf-line-endings

Conversation

@P4suta

@P4suta P4suta commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Replaces #43, which was branched from an older main. Same change, rebuilt on top of 10bbafb.

Why

The repo checks C#/MSBuild/XAML out as CRLF while CI shell and YAML must stay LF, with .editorconfig's end_of_line = crlf as the gate. That split is a Windows-only convention, and it costs more than it buys:

  • every tool that emits LF fights the dotnet format gate;
  • .gitattributes already needed a "CI must stay LF" carve-out, i.e. the rule could not be applied uniformly;
  • tests/Snaply.Tests/Snaply.Tests.csproj had reached the blob with CRLF (git ls-files --eoli/crlf), so it shows as modified in every clone, permanently, and git checkout -- cannot clear it — only git add --renormalize can.

LF-in-the-repo is the cross-platform default (git stores LF regardless), so this drops the exception list rather than extending it.

What

  • .gitattributes: collapse the per-extension CRLF/LF rules to a single * text=auto eol=lf, keeping the binary rules.
  • .editorconfig: end_of_line = crlflf.
  • git add --renormalize .

Only the one csproj blob actually changes — every other file was already LF in the blob and merely checked out as CRLF. The working tree is now LF too, so dotnet format sees what git stores.

Verification

Run locally on Windows 11 / SDK 10.0.301:

  • dotnet format Snaply.slnx --verify-no-changes --no-restore (with Configuration=Release, as CI does) → exit 0
  • git ls-files --eol → no i/crlf entries remain
  • git diff --ignore-cr-at-eol reports no content change — the diff is line endings only

🤖 Generated with Claude Code

The repo checked C#/MSBuild/XAML out as CRLF while CI shell and YAML had to stay
LF, with .editorconfig's `end_of_line = crlf` as the gate. That split is a
Windows-only convention and it cost more than it bought: every tool that emits LF
fought the format gate, .gitattributes already needed a "CI must stay LF"
carve-out, and tests/Snaply.Tests/Snaply.Tests.csproj had reached the blob with
CRLF, so it showed as modified in every clone and `git checkout --` could not
clear it.

Collapse .gitattributes to a single `* text=auto eol=lf`, flip .editorconfig to
`end_of_line = lf`, and renormalize. Only the one csproj blob actually changed —
the rest were already LF in the blob and merely checked out as CRLF.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@P4suta
P4suta merged commit 6af7282 into main Jul 24, 2026
9 checks passed
@P4suta
P4suta deleted the chore/lf-line-endings branch July 24, 2026 01:26
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