Repository navigation
fix(build): preserve LF text checkouts on Windows - #1807
Merged
morluto merged 1 commit intoOct 11, 2026
Merged
Conversation
Pin text checkouts to LF so Git for Windows with core.autocrlf=true does not make the repository formatting gate fail on a clean clone. Keep command fixtures in CRLF and retain automatic binary detection.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Owner
|
Looks great! Thank you! |
3 tasks done
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
A clean Windows checkout with
core.autocrlf=truefails REA's formatting gate because Git converts LF text blobs to CRLF while the existing formatter expects LF. Add a five-line repository checkout policy to keep detected text in LF, preserve CRLF for Windows CMD fixtures, and retain automatic binary detection.Problem and expected behavior
Reproduced on Windows 11 with Git 2.54.0.windows.1, Node 24.18.0 and npm 11.16.0. The updated upstream baseline is
ed084b3dbb13ec9dee1adc8f5b76e784b52c00bb; the rebased fix isf5858d595ae6f7762384da6bc87b244cb7c7fc3a, whose direct parent is that baseline.With a clean Git status and
core.autocrlf=true, the baseline rejects all 2,526 formatter inputs. The same commands pass after the policy is present at checkout. The fix lets contributors keep their existing Git configuration and use the repository's required verification commands.Change and scope
The complete change is the following new
.gitattributes:Detected text is checked out as LF. The later CMD rule overrides the default and checks CMD files out as CRLF; their Git blobs remain LF. Binary detection is unchanged. No application code, dependencies, formatter configuration, generated outputs or existing blobs change.
Existing working directories may retain old line endings until files are checked out again. Preserve local edits before refreshing files, or use a new clone. No destructive refresh command is required by the reproduction below.
Contract and boundary impact
Evidence and regression coverage
Two complete fresh local clones used
--no-local --no-checkout. Each clone received localcore.autocrlf=truebefore its first checkout and its ownnpm ci. Neither reused the development working tree, index, dependencies, build outputs or Turbo cache. Only npm's download cache and the pinned installed toolchain were shared.npm cinpm run format:checknpm run checkActual file-byte checks in the fixed clone verified all 2,416 source files and four Shell scripts as LF, the CMD fixture as CRLF, and both tracked PNGs as byte-for-byte identical to their Git blobs. PNG SHA-256 hashes were identical in both clones and in the corresponding blobs. No new repository test files are added; the regression exercises actual Git checkout and the real formatter.
Reproduce on Windows
Use the pinned Node 24.18.0 and npm 11.16.0 on PATH. Run from a local checkout containing this commit; the script creates two new sibling clones and sets only their local Git configuration. Use a drive with enough free space. Baseline command failures are expected; PowerShell 7 users who have enabled
PSNativeCommandUseErrorActionPreferenceshould run this in a fresh default PowerShell session so the expected native exit 1 can be recorded.Expected output: baseline
format=1 check=1; fixformat=0 check=0. Both Git statuses remain clean. Source and Shell files change fromi/lf w/crlftoi/lf w/lf; CMD remainsi/lf w/crlf; the PNG remainsi/-text w/-text.Related work: #1101 proposed fixture-scoped attributes as part of a larger change and is closed without merging. #1704 and #1706 report the same Windows formatting failure but do not implement this policy. No dedicated issue was identified. Live checks inspected all 42 open PRs' complete file lists, the 100 most recently updated merged PRs, current main's attribute history, and searches for gitattributes, autocrlf, CRLF and line endings; no equivalent open or merged checkout-policy fix was found.
Validation performed
On the exact rebased commit above:
npm ci,npm run check:fast,npm run check,npm run build:cached, andnpm run docs:check— passed in the development checkout.npm run test:focused -- src/config.test.ts src/windows/WindowsNativeLoader.test.ts src/windows/WindowsOwnedProcess.test.ts src/domain/javascript/javascriptStaticAnalysisSourceMaps.test.ts tests/boundary/providers/ghidra/ghidraLauncher.test.ts tests/acceptance/webSourceLocationCli.test.ts— 109 tests passed across six files, including the real Windows CMD launcher fixture and compiled CLI/MCP source-map parity.bash -n— all four Shell files passed in both fresh clones. This is syntax-only Git Bash coverage.cmd.exe— expected exit 64 in both fresh clones. Full fixture behavior is covered separately by the focused Ghidra launcher boundary tests.Compatibility, safety, and release
Review checklist