Skip to content

chore: LF line endings everywhere - #13

Merged
rent-a-developer merged 3 commits into
mainfrom
chore/12-lf-line-endings
Sep 2, 2026
Merged

rent-a-developer merged 3 commits into
mainfrom
chore/12-lf-line-endings

Conversation

@rent-a-developer

Copy link
Copy Markdown
Owner

Closes #12.

Merge with a merge commit (not squash, not rebase). This PR adds .git-blame-ignore-revs, which
names the renormalization commit by SHA. Squash and rebase rewrite that SHA, git silently ignores an
entry it cannot resolve, and the new CI check would then fail on main.

Every text file is now LF, in the repository and in the working tree, on every OS. After this PR the
repository has no batch or shell scripts, so there is no exception.

Commits

  1. chore: store every text file as LF — the policy, the scripts and the docs. .gitattributes
    is reduced to * text=auto eol=lf plus the binary list, .editorconfig sets end_of_line = lf, and
    the five shell/batch scripts are replaced by three PowerShell scripts: scripts/tidy-code.ps1,
    scripts/clean-build-artifacts.ps1 and scripts/extract-release-notes.ps1. The lint job calls
    tidy-code.ps1 -Check and gains a renormalization guard and a .git-blame-ignore-revs check.
    The script replacement and the policy land together because tidy-code.ps1 normalizes line endings:
    applied while .gitattributes still pinned CRLF, its check would contradict the attributes.
  2. style: renormalize line endings to LFgit add --renormalize .. Fixes
    Directory.Packages.props, which was stored with CRLF against an attribute asking for LF, and so
    showed a whole-file diff on a clean checkout that no checkout could repair.
  3. chore: add the renormalization commit to .git-blame-ignore-revs — lists commit 2, so blame skips it.

Why

The per-type table needed a decision for every new file type, and the types nobody listed silently got
whatever each contributor's core.autocrlf produced — while one file had drifted to CRLF in the index
with nothing to notice it.

XamlStyler always writes the host OS newline and has no setting for it, so on Windows it turned every
XAML file it touched into CRLF. Git stored LF regardless, but the working tree kept reporting those
files as modified with an empty git diff. tidy-code.ps1 ends with a CRLF-to-LF pass, which removes
that entirely and is a no-op on Linux and macOS.

That also fixes the formatting gate. -Check formats the tree and asks whether that changed anything,
instead of asking XamlStyler's passive check — which on Windows fails on LF files whatever their layout.
The answer is now the same on every OS, so contributors can verify locally wherever they work, and CI
runs the same command they do. The lint job moves to ubuntu-latest, which is now a cost choice
rather than a requirement.

For contributors

  • Nothing to configure. core.autocrlf no longer matters.
  • scripts/formatCode.*, scripts/clean.* and scripts/extract-release-notes.sh are gone. Use:
    pwsh -File scripts/tidy-code.ps1
    pwsh -File scripts/clean-build-artifacts.ps1
  • Optional one-time clone refresh for an all-LF working tree — commit or stash first, as the second
    command discards uncommitted work:
    git rm -r --cached . -q
    git reset --hard
  • If a tool writes CRLF into your working tree, git status shows the file as modified while
    git diff stays empty. Run pwsh -File scripts/tidy-code.ps1, or git checkout -- <path>.
  • With core.safecrlf=true (not a default) git add refuses such a file; run the tidy script, or set
    core.safecrlf warn.
  • Open branches rebase cleanly; a line-ending conflict resolves with git merge -X renormalize.

Verification

  • lint green on ubuntu: tidy-code.ps1 -Check, the renormalization guard and the blame-revs check.
  • pwsh -File scripts/tidy-code.ps1 -Check exits 0 on Windows and on Linux.
  • pwsh -File scripts/tidy-code.ps1 followed by git status leaves nothing listed.
  • git ls-files --eol shows no i/crlf or i/mixed entries.
  • No .cmd, .bat or .sh file remains, and no reference to the old script names.
  • Full CI matrix green, including the Windows WPF jobs.

rent-a-developer and others added 3 commits September 2, 2026 10:22
.gitattributes loses its per-type pins, so a new file type needs no
decision, and the explicit eol= overrides whatever core.autocrlf a
contributor has.

The batch and shell scripts are replaced by three PowerShell scripts.
tidy-code.ps1 also rewrites the line endings XamlStyler cannot: the
tool always writes the host newline, which on Windows left every XAML
file listed as modified with an empty diff. Its -Check mode formats
the tree and asks whether that changed anything, so the lint job now
gives the same answer on every OS.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@rent-a-developer rent-a-developer self-assigned this Sep 2, 2026
@rent-a-developer rent-a-developer linked an issue Sep 2, 2026 that may be closed by this pull request
9 tasks
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@rent-a-developer
rent-a-developer merged commit 5314583 into main Sep 2, 2026
16 checks passed
@rent-a-developer
rent-a-developer deleted the chore/12-lf-line-endings branch September 2, 2026 23:30
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.

LF line endings everywhere

1 participant