tooling: Force LF line endings via .gitattributes.#397
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
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=lfto force LF for all text files regardless ofcore.autocrlf. - Mark common firmware/archive/image formats as
binaryto prevent any EOL conversion.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🎉 This PR is included in version 0.16.9 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a repository-level
.gitattributespinning every text file to LF. Husky hooks, MicroPython sources, and Makefile recipes all assume LF, and Git for Windows' defaultcore.autocrlf=truewas silently rewriting.husky/pre-committo CRLF on Windows + WSL clones — the trailing\rbreaks#!/usr/bin/env shon WSL.Approach
text=autolets Git auto-detect text vs. binary.eol=lfforces text files to LF on checkout on every platform. Explicitbinaryentries protect firmware artifacts from any conversion.Migration for existing clones
After pull, contributors (especially on Windows + WSL) should run:
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-opCloses
#396