feat(detector): detect missing CRLF-safe .gitattributes (line-ending drift) - #1
Merged
Conversation
…drift) Adds a line-ending drift check: a repo that ships text source but lacks `* text=auto eol=lf` in `.gitattributes` silently checks out CRLF working-tree bytes on Windows (core.autocrlf=true) while the index stores LF, breaking byte-exact checks. `driftcheck --fix` now appends the rule (or creates the file). This is the exact pattern applied across the archify/gods-eye-view CRLF PRs; driftcheck can now catch it before contributors hit a build failure, same as it does for Rust/Node/Python/Go version drift. - find_lineending_drift(root) scans .gitattributes - scan_repo() reports lineending_drifts - apply_fixes() creates/appends `* text=auto eol=lf` - 3 new tests (detect, fix, no-false-positive) Bump Checks to v0.1.5 in README.
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
Adds a line-ending drift check to
driftcheck. A repo that ships text source but lacks* text=auto eol=lfin.gitattributessilently checks out CRLF working-tree bytes on Windows (core.autocrlf=true) while the index stores LF — breaking byte-exact checks.driftcheck --fixnow appends the rule (or creates the file).This is the exact pattern applied across the archify/gods-eye-view CRLF PRs; driftcheck can now catch it before contributors hit a build failure, same as it does for Rust/Node/Python/Go version drift.
Changes
find_lineending_drift(root)scans.gitattributesscan_repo()reportslineending_driftsapply_fixes()creates/appends* text=auto eol=lfVerification
python3 -m pytest tests/ -q→ 21 passed.