From bcd78813648e1fddfa96135a77abc629f78f306a Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 15 Oct 2026 02:03:21 +0800 Subject: [PATCH] git: every text file checks out with LF, so a Windows checkout with autocrlf on doesn't turn four guard tests red (#1827, EdwinDigital) TestEveryNoticeIsTranslated (agent), TestBuiltinsTranslated, TestPurposeAssetMatchesUsage and TestRedactKindsAreRedacts (gui) parse source files with LF-only patterns. Git for Windows' default core.autocrlf=true checked those files out with CRLF, and all four failed there; EdwinDigital found they pass from an LF checkout. A root .gitattributes with `* text=auto eol=lf` makes every text file check out with LF whatever autocrlf says. internal/agent/testdata's own `* -text` still keeps its CRLF .cmd fixtures byte for byte. The index already holds every text file with LF (git ls-files --eol: the only i/crlf files are those two -text fixtures), so nothing is renormalised. Run: two --shared clones with core.autocrlf=true and a sparse checkout of internal/gui/assets, notice.go and the mise-windows fixtures. At the parent, i18n.js and app.js check out with CRLF; at this commit with LF, snow.cmd keeps CRLF, and git status is clean in both. Not run: the four guard tests on a Windows checkout (no Go on the Windows box); a checkout made before this commit keeps its CRLF until the files are checked out again, as in a fresh clone. --- .gitattributes | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..8d4514dc0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +# Every text file checks out with LF, whatever core.autocrlf says: the +# guard tests parse source files line by line (the notices, the built-in +# and purpose assets, the redaction kinds), and gofmt writes LF. A Windows +# checkout with autocrlf on gave them CRLF and four went red (#1827). +# internal/agent/testdata/.gitattributes keeps its real CRLF bytes. +* text=auto eol=lf