Skip to content

Commit 349e189

Browse files
authored
tooling: Force LF line endings via .gitattributes. (#397)
Closes #396. Contributors on Windows + WSL hit a shebang error on husky hooks because Git for Windows defaults to core.autocrlf=true and rewrites .husky/pre-commit with CRLF line endings on checkout. The trailing \r turns `#!/usr/bin/env sh` into a shebang that WSL cannot resolve. This repo is developed exclusively on Linux / macOS / WSL — no file here should ever be CRLF. Pin every text file to LF via `* text=auto eol=lf` and declare common binary artifacts explicitly so no conversion is attempted on them.
1 parent eb594a8 commit 349e189

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

.gitattributes

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Force LF line endings on every text file.
2+
#
3+
# This repo is developed on Linux / macOS / WSL. Shell scripts (including
4+
# husky git hooks) and MicroPython sources must stay LF — a CRLF shebang
5+
# breaks `#!/usr/bin/env sh` on Unix shells, and CRLF in Python files
6+
# confuses some MicroPython parsers.
7+
#
8+
# `text=auto eol=lf` lets Git detect text vs. binary files automatically
9+
# and checks text files out as LF, regardless of the contributor's
10+
# `core.autocrlf` setting (which is `true` by default on Git for Windows).
11+
12+
* text=auto eol=lf
13+
14+
# Explicit declarations for common binary artifacts — no EOL conversion.
15+
*.bin binary
16+
*.hex binary
17+
*.elf binary
18+
*.dfu binary
19+
*.png binary
20+
*.jpg binary
21+
*.jpeg binary
22+
*.ico binary
23+
*.gif binary
24+
*.pdf binary
25+
*.zip binary
26+
*.tar binary
27+
*.gz binary
28+
*.bz2 binary

0 commit comments

Comments
 (0)