Skip to content

tooling: Force LF line endings via .gitattributes.#397

Merged
nedseb merged 1 commit intomainfrom
tooling/gitattributes-lf
Apr 14, 2026
Merged

tooling: Force LF line endings via .gitattributes.#397
nedseb merged 1 commit intomainfrom
tooling/gitattributes-lf

Conversation

@nedseb
Copy link
Copy Markdown
Contributor

@nedseb nedseb commented Apr 14, 2026

Summary

Add a repository-level .gitattributes pinning every text file to LF. Husky hooks, MicroPython sources, and Makefile recipes all assume LF, and Git for Windows' default core.autocrlf=true was silently rewriting .husky/pre-commit to CRLF on Windows + WSL clones — the trailing \r breaks #!/usr/bin/env sh on WSL.

Approach

* text=auto eol=lf

*.bin binary
*.hex binary
# ... other binary extensions

text=auto lets Git auto-detect text vs. binary. eol=lf forces text files to LF on checkout on every platform. Explicit binary entries protect firmware artifacts from any conversion.

Migration for existing clones

After pull, contributors (especially on Windows + WSL) should run:

git pull
git add --renormalize .
git status  # if anything appears, commit it

Verified on the current tree: nothing shows up, all tracked files were already LF locally. Windows + WSL clones, however, likely have CRLF versions on disk — the renormalize step fixes them without any content change.

Test plan

  • git add --renormalize . on a clean LF tree is a no-op
  • Aline re-clones / renormalizes on Windows + WSL → husky hooks run without the shebang error

Closes

#396

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.
Copilot AI review requested due to automatic review settings April 14, 2026 11:59
@nedseb nedseb merged commit 349e189 into main Apr 14, 2026
13 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a repository-level .gitattributes to ensure all text files are checked out with LF line endings across platforms, preventing CRLF-related failures (notably husky hook shebang issues on Windows + WSL) and keeping MicroPython sources consistently LF.

Changes:

  • Introduce * text=auto eol=lf to force LF for all text files regardless of core.autocrlf.
  • Mark common firmware/archive/image formats as binary to prevent any EOL conversion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nedseb nedseb deleted the tooling/gitattributes-lf branch April 14, 2026 12:02
@semantic-release-updater
Copy link
Copy Markdown

🎉 This PR is included in version 0.16.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants