Skip to content

chore: normalize line endings to LF everywhere#43

Closed
P4suta wants to merge 1 commit into
mainfrom
chore/normalize-line-endings-to-lf
Closed

chore: normalize line endings to LF everywhere#43
P4suta wants to merge 1 commit into
mainfrom
chore/normalize-line-endings-to-lf

Conversation

@P4suta

@P4suta P4suta commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Why

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 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 showed as modified in every clone, permanently, and git checkout -- could not 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 changed — 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
  • dotnet test tests/Snaply.Tests/Snaply.Tests.csproj -c Release → 65 passed, 0 skipped
  • dotnet test tests/Snaply.App.Tests/Snaply.App.Tests.csproj -c Release → 3 passed, 0 skipped
  • git ls-files --eol → no i/crlf and no w/crlf entries remain
  • git status clean; git diff reports no content change (the change 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, 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 commented Jul 24, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #45 — same change, rebuilt on top of the current main (10bbafb) instead of force-pushing this branch.

@P4suta P4suta closed this Jul 24, 2026
@P4suta
P4suta deleted the chore/normalize-line-endings-to-lf branch July 24, 2026 01:20
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