From c940f31ec7c144cefbe57839c790e81ec7e61082 Mon Sep 17 00:00:00 2001 From: Mikkeli Matlock Date: Mon, 14 Sep 2026 01:39:09 +0900 Subject: [PATCH] chore: pin LF line endings in .gitattributes The branding checker failed all 29 of its sites on Windows while passing on the Linux CI runner. Nothing had drifted. Git for Windows installs with core.autocrlf=true, which checked tools/branding-sites.tsv out as CRLF, and the checker reads that table with `read` - so every row's last field, the pattern, gained a trailing \r and matched nothing. Only *.sh was pinned to LF, which is why the scripts were fine and their data was not. Set the policy in the repository rather than trusting each machine: * text=auto eol=lf LF in the repo and every working tree, every OS *.sh text eol=lf kept explicit: a CRLF shebang is a hard failure *.bat/*.cmd eol=crlf the one exception; cmd.exe misparses LF batch files An attribute beats core.autocrlf, so a fresh clone gets LF however its machine is configured. Verified in a throwaway repo: under autocrlf=true a text file checks out LF and a .bat checks out CRLF. No blob changes. Every committed blob was already LF (git ls-files --eol shows i/lf throughout) and `git add --renormalize .` stages nothing but this file. The working tree was re-checked-out to match: 25 files CRLF -> LF, deploy.bat LF -> CRLF. Checker 40 passed / 0 failed, build clean, 20 tests pass. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01LU1NRL7fAaZTtFMTTPn2b1 --- .gitattributes | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.gitattributes b/.gitattributes index 62da761..a6266de 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,20 @@ -# Shell scripts must keep LF endings. core.autocrlf=true on Windows would -# otherwise check them out CRLF, which a strict POSIX sh (dash, CI containers) -# rejects at the shebang. +# Line endings: LF in the repository and in every working tree, on every OS. +# +# This file is the policy, not each machine's git config. Git for Windows installs +# with core.autocrlf=true, which checks text out as CRLF; an attribute here beats +# that setting, so a fresh clone gets LF regardless of how its machine is set up. +# +# It matters beyond tidiness. tools/branding-sites.tsv is read line by line with +# `read`, and under CRLF every row's last field gained a trailing - so the +# branding checker reported all 29 sites as missing on Windows while passing on the +# Linux CI runner. text=auto leaves genuinely binary files alone. +* text=auto eol=lf + +# Shell scripts are pinned explicitly as well: a strict POSIX sh (dash, CI +# containers) rejects a CRLF shebang outright rather than misbehaving quietly. *.sh text eol=lf + +# The exception. cmd.exe misparses LF-only batch files around labels and long +# lines, so these alone are checked out CRLF. The repository copy is still LF. +*.bat text eol=crlf +*.cmd text eol=crlf