Cloning the forge repo on Windows and running the suite there turned up two things a checkout inside the monorepo could never show, because this working copy has core.autocrlf=false. Git on Windows defaults to autocrlf=true, so a fresh clone gets CRLF. For most files that is cosmetic. For shell scripts it is not: install.sh copied from such a clone onto a server fails with `bash: \r: command not found`, which tells the person almost nothing about what is wrong. And a CRLF-rewritten .patch file is no longer the bytes `patch` was given. .gitattributes now pins eol=lf for the scripts, the container inputs and the source, and marks *.patch as binary so nothing rewrites it at all. tools/refresh-patches.sh --check also compares with --strip-trailing-cr, so a clone made before this landed reports honestly instead of claiming the patch record has drifted when it has not. A check that cries wolf is a check somebody switches off.
29 lines
1.1 KiB
Text
29 lines
1.1 KiB
Text
# Line endings, pinned where getting them wrong breaks something.
|
|
#
|
|
# Git on Windows defaults to core.autocrlf=true, which rewrites LF to CRLF on
|
|
# checkout. For most files that is harmless. For these it is not:
|
|
|
|
# Shell scripts run on Linux. A CRLF checkout that is copied to a server
|
|
# fails with `bash: \r: command not found`, which tells you almost nothing
|
|
# about what is wrong.
|
|
*.sh text eol=lf
|
|
install.sh text eol=lf
|
|
|
|
# Patch files must survive byte for byte: `patch` and `git apply` both care,
|
|
# and tools/refresh-patches.sh --check compares them against freshly
|
|
# generated LF output.
|
|
*.patch -text
|
|
|
|
# Container and CI inputs are read by Linux tooling.
|
|
Dockerfile text eol=lf
|
|
*.yml text eol=lf
|
|
.env.example text eol=lf
|
|
docker/nginx/* text eol=lf
|
|
|
|
# PHP and JS are served, not executed by a shell, so either ending works —
|
|
# but keeping them LF means a diff between a Windows and a Linux checkout is
|
|
# about the code rather than about the line endings.
|
|
*.php text eol=lf
|
|
*.js text eol=lf
|
|
*.css text eol=lf
|
|
*.md text eol=lf
|