chore: LF line endings everywhere - #13
Merged
Merged
Conversation
.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>
9 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Closes #12.
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
chore: store every text file as LF— the policy, the scripts and the docs..gitattributesis reduced to
* text=auto eol=lfplus the binary list,.editorconfigsetsend_of_line = lf, andthe five shell/batch scripts are replaced by three PowerShell scripts:
scripts/tidy-code.ps1,scripts/clean-build-artifacts.ps1andscripts/extract-release-notes.ps1. Thelintjob callstidy-code.ps1 -Checkand gains a renormalization guard and a.git-blame-ignore-revscheck.The script replacement and the policy land together because
tidy-code.ps1normalizes line endings:applied while
.gitattributesstill pinned CRLF, its check would contradict the attributes.style: renormalize line endings to LF—git add --renormalize .. FixesDirectory.Packages.props, which was stored with CRLF against an attribute asking for LF, and soshowed a whole-file diff on a clean checkout that no checkout could repair.
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.autocrlfproduced — while one file had drifted to CRLF in the indexwith 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.ps1ends with a CRLF-to-LF pass, which removesthat entirely and is a no-op on Linux and macOS.
That also fixes the formatting gate.
-Checkformats 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
lintjob moves toubuntu-latest, which is now a cost choicerather than a requirement.
For contributors
core.autocrlfno longer matters.scripts/formatCode.*,scripts/clean.*andscripts/extract-release-notes.share gone. Use:command discards uncommitted work:
git rm -r --cached . -q git reset --hardgit statusshows the file as modified whilegit diffstays empty. Runpwsh -File scripts/tidy-code.ps1, orgit checkout -- <path>.core.safecrlf=true(not a default)git addrefuses such a file; run the tidy script, or setcore.safecrlf warn.git merge -X renormalize.Verification
lintgreen on ubuntu:tidy-code.ps1 -Check, the renormalization guard and the blame-revs check.pwsh -File scripts/tidy-code.ps1 -Checkexits 0 on Windows and on Linux.pwsh -File scripts/tidy-code.ps1followed bygit statusleaves nothing listed.git ls-files --eolshows noi/crlfori/mixedentries..cmd,.bator.shfile remains, and no reference to the old script names.