Check out text files with LF on every platform
Problem
Git for Windows installs with core.autocrlf=true, so a fresh clone checks every text file out with CRLF. .gitattributes pins only *.sh to LF, while .prettierrc.json sets "endOfLine": "lf". On such a clone of main at 9dfebdd:
- prettier rejects 102 of the files under
web/*.jsandtests/browser/*.js, so the pre-commit hook refuses any commit that stages a web file. The hook checks agit checkout-indexcopy of the index, and that checkout appliesautocrlftoo, so even content stored as LF fails there. npm testfails 33 more tests than on an LF checkout, the ones that read source text with patterns that do not expect\r, such as "the module state the first paint reads exists before init paints" and "the gutter is rebuilt only when the line count moves".
Change
* text=auto eol=lf at the top of .gitattributes checks every text file out with LF whatever core.autocrlf says. The later lines still override it for the paths they name, so web/vendor/** keeps -text and its hashed bytes stay untouched. git add --renormalize . stages nothing but .gitattributes itself: every text file is already stored as LF, so no content changes.
Test
Two fresh worktrees checked out with git -c core.autocrlf=true, on Windows 11 with Git for Windows and Node 24.20.0:
main at 9dfebdd | this branch | |
|---|---|---|
| files checked out with CRLF | 649 | 0 |
| JS files prettier rejects | 102 | 0 |
npm test failures | 127 | 94 |
The 33 tests that stop failing are all ones that read source text, and no test fails on the branch that passes on main. None of the 94 that remain is about line endings: they need vendored assets the worktree has not fetched or a C++ compiler with -std=c++20, or they are the four tests #322 reports. Staging a one-line comment in web/lib.js and committing fails the pre-commit hook on main with "Code style issues found" and passes its staged checks on this branch. The Rust lanes of ./scripts/test.sh were not run.
This is separate from #322 and #323, which fix the four tests that pass an absolute Windows path to import(); that failure happens with LF too.
Summary by cubic
Pins every text file to LF in the working tree so Windows clones, where Git for Windows defaults core.autocrlf to true, get the same line endings as everywhere else. The new * text=auto eol=lf line at the top of .gitattributes overrides that default; later lines still win for the paths they name, so web/vendor/** keeps -text and its hashed bytes stay untouched.
- Fixes the pre-commit hook on fresh Windows clones, where prettier rejected all JS files because
.prettierrc.jsonasks for LF, blocking any commit touchingweb/. - Resolves failures in tests that read source text and tripped over
\r. - The repository already stores every text file as LF, so no file content changes beyond
.gitattributesitself.