From a4d1d7a93750b21a2a4feb31740ce7bf53ce4367 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Sun, 16 Aug 2026 21:50:28 +0100 Subject: [PATCH] chore: check out all text files with LF via .gitattributes brush is a shell, and its test corpus is shell scripts. Shell is newline-sensitive in ways most languages are not: a stray CR becomes part of a here-document delimiter, a command name, or a `#!` interpreter path. On a Windows checkout with core.autocrlf=true every text file lands as CRLF, and several compat tests fail as a result -- not because brush is wrong, but because the fixtures were mangled on their way to disk. Two examples of the resulting noise: /usr/bin/env: 'bash\r': Permission denied process-helpers.sh: line 1: syntax error near unexpected token `$'{\r'' The repository had no .gitattributes at all, so the checkout representation was left entirely to each contributor's local git configuration. Add one that pins every text file to LF on all platforms. `text` rather than `text=auto` states the intent outright instead of deferring to git's binary heuristic, so a newly added file cannot be silently classified as binary and escape normalization. The sole real binary in the tree, the docs screenshot, is exempted with `binary` (shorthand for `-text -diff`). No content is rewritten by this change: `git ls-files --eol` reports every one of the 674 tracked text files as already `i/lf`, and `git add --renormalize .` stages nothing beyond this file. CRLF only ever existed in the working tree, injected at checkout. This commit makes that guarantee explicit and permanent rather than a property of how any one contributor happens to be configured. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .gitattributes | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..fb1947aa2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,16 @@ +# brush is a shell. Its test corpus is shell scripts, and shell is +# newline-sensitive in ways most languages are not: a stray CR becomes part of a +# here-document delimiter, a command name, or a `#!` interpreter path. A CRLF +# checkout therefore doesn't just look different, it changes behavior -- so the +# line ending is a correctness concern here, not a formatting preference. +# +# Every text file is checked out with LF on all platforms, regardless of the +# user's core.autocrlf setting. `text` (not `text=auto`) is deliberate: it states +# the intent outright rather than leaving it to git's binary heuristic, so a new +# file can never be silently classified as binary and escape normalization. +* text eol=lf + +# The one genuine binary in the tree. `binary` is shorthand for `-text -diff`, +# which exempts it from the rule above; without this the blanket `text` would +# corrupt it on checkout. +*.png binary