Add .gitattributes to enforce LF line endings#8
Conversation
The repository is already stored with LF endings, but it had no .gitattributes and core.autocrlf is unset, so Windows checkouts silently rewrote files to CRLF and surfaced the entire tree as modified. This adds an explicit normalization policy (LF in the repo; CRLF only for Windows .bat/.cmd; binaries untouched) to stop that churn going forward. Co-Authored-By: Claude <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds repository-wide ChangesLine ending normalization
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR introduces a repository-wide Git attributes policy to normalize text files to LF line endings while preserving CRLF for Windows batch scripts and preventing any line-ending conversion for common binary asset types. This helps avoid noisy diffs on Windows checkouts (especially when core.autocrlf isn’t configured) and keeps future PRs focused on real changes.
Changes:
- Add
.gitattributeswith* text=auto eol=lfto enforce LF for text files. - Add overrides to keep
*.bat/*.cmdas CRLF. - Mark common binary extensions as
binaryto avoid any EOL processing.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.gitattributes (1)
8-19: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider adding more common binary extensions for deterministic handling.
The current binary list is solid for the stated cohort. For broader determinism, you may also want to explicitly mark:
.so,.dylib,.class,.war,.tar,.bz2,.7z,.rar,.woff,.woff2,.ttf,.mp3,.mp4,.mov, and.avi. This ensures Git never attempts text normalization on them regardless of heuristic misclassification.Not blocking —
text=autogenerally handles these correctly.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.gitattributes around lines 8 - 19, The binary asset rules in .gitattributes should be expanded to cover more common formats so Git never normalizes them as text; update the existing binary list to explicitly include the additional extensions mentioned in the review, keeping the current pattern style consistent. Use the .gitattributes binary section as the place to add these entries so deterministic handling is applied alongside the current markers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.gitattributes:
- Around line 8-19: The binary asset rules in .gitattributes should be expanded
to cover more common formats so Git never normalizes them as text; update the
existing binary list to explicitly include the additional extensions mentioned
in the review, keeping the current pattern style consistent. Use the
.gitattributes binary section as the place to add these entries so deterministic
handling is applied alongside the current markers.
|
Superseded by #11, which consolidates this work (the finetune and decoy/FDRBench fixes landed only on |
What
Adds a
.gitattributesthat normalizes text to LF in the repository (CRLF only for Windows.bat/.cmd; binaries untouched).Why
The repo had no
.gitattributesandcore.autocrlfis unset, so Windows checkouts silently rewrote files to CRLF, surfacing the entire tree as modified and otherwise burying real changes under line-ending churn. The repository is already stored as LF, so no existing file contents change — this PR is just the normalization policy.Notes
Two follow-up PRs are stacked on this one (OspreySharp feature, then installer + CI). Merging this first keeps their diffs clean.
Summary by CodeRabbit