Skip to content

Normalize line endings to LF on checkin - #31057

Open
fmeum wants to merge 1 commit into
bazelbuild:masterfrom
fmeum:normalize-line-endings
Open

Normalize line endings to LF on checkin#31057
fmeum wants to merge 1 commit into
bazelbuild:masterfrom
fmeum:normalize-line-endings

Conversation

@fmeum

@fmeum fmeum commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Description

Replace the * -text rule in .gitattributes with * text=auto eol=lf.

-text disables 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=lf keeps checkouts on LF regardless of core.autocrlf and 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

  • I have added tests for the new use cases (if any).
  • I have updated the documentation (if applicable).

Release Notes

RELNOTES: None

`* -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
fmeum marked this pull request as ready for review September 9, 2026 15:33
@fmeum
fmeum requested a review from meteorcloudy September 9, 2026 15:33
@github-actions github-actions Bot added the awaiting-review PR is awaiting review from an assigned reviewer label Sep 9, 2026
@iancha1992 iancha1992 added team-Rules-Java Issues for Java rules team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website and removed team-Rules-Java Issues for Java rules labels Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR is awaiting review from an assigned reviewer team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants