Normalize line endings to LF on checkin - #31057
Open
fmeum wants to merge 1 commit into
Open
Conversation
`* -text` disables Git's end-of-line conversion in both directions: it keeps Windows checkouts on LF, but it also stores CRLF verbatim whenever a contributor's editor writes it, which turns a small change into a whole-file diff (see bazelbuild#31056). `* text=auto eol=lf` keeps checkouts on LF regardless of core.autocrlf and additionally converts CRLF to LF on checkin for files that Git detects as text. Binary files are detected by content and left alone. Existing files are unaffected: every text file in the tree already uses LF, and Git does not renormalize a file whose index copy already contains CR (CHANGELOG.md) unless asked to via `git add --renormalize`.
fmeum
marked this pull request as ready for review
September 9, 2026 15:33
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.
Description
Replace the
* -textrule in.gitattributeswith* text=auto eol=lf.-textdisables Git's end-of-line conversion in both directions. It keeps Windows checkouts on LF (the fix for #26467 in #26469), but it also makes Git store CRLF verbatim whenever a contributor's editor writes it.text=auto eol=lfkeeps checkouts on LF regardless ofcore.autocrlfand additionally converts CRLF to LF on checkin for files that Git detects as text, so stray CRLF can no longer reach the repository.Existing files and clones are unaffected.
Motivation
#31056 shows as +2820/−2769 on GitHub, but only +54/−3 with carriage returns ignored.
Build API Changes
No
Checklist
Release Notes
RELNOTES: None