feat: add .gitattributes to enforce LF line endings#1550
Conversation
Prevents Windows/NTFS contributors with core.autocrlf=true from accidentally converting the entire codebase CRLF→LF, which produces PRs with +600k/-600k diffs across 700+ files. - * text=auto normalizes all text files to LF on checkin - Explicit binary markers for images, fonts, archives, compiled code - No code changes — config-only, zero risk
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📜 Recent review details⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🧰 Additional context used📓 Path-based instructions (4)**/*⚙️ CodeRabbit configuration file
Files:
src/{components/permissions,utils/permissions,hooks/toolPermission,tools,entrypoints/sdk}/**⚙️ CodeRabbit configuration file
Files:
**⚙️ CodeRabbit configuration file
Files:
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}⚙️ CodeRabbit configuration file
Files:
🔇 Additional comments (3)
📝 WalkthroughWalkthroughAdds a repository ChangesGit attributes configuration
WebSearchTool providers: tests and provider
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 7✅ Passed checks (7 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In @.gitattributes:
- Line 69: The .gitattributes entry marking SVGs as binary disables
diffs/merges; change the '*.svg binary' attribute to treat SVGs as text (e.g.,
replace 'binary' with 'text' or 'text eol=lf') so XML-based SVG files are
diffable/mergeable; update the '*.svg' attribute line accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c7c0d851-037e-4ccf-8082-b753d44b168c
📒 Files selected for processing (1)
.gitattributes
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: smoke-and-tests
🔇 Additional comments (1)
.gitattributes (1)
1-68: LGTM!Also applies to: 70-125
| *.jpeg binary | ||
| *.gif binary | ||
| *.ico binary | ||
| *.svg binary |
There was a problem hiding this comment.
Use text attributes for SVG instead of binary.
Line 69 marks *.svg as binary, which suppresses useful diffs/merges for XML-based SVG files. Prefer text normalization here.
Suggested change
-*.svg binary
+*.svg text📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| *.svg binary | |
| *.svg text |
🤖 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 at line 69, The .gitattributes entry marking SVGs as binary
disables diffs/merges; change the '*.svg binary' attribute to treat SVGs as text
(e.g., replace 'binary' with 'text' or 'text eol=lf') so XML-based SVG files are
diffable/mergeable; update the '*.svg' attribute line accordingly.
SVGs are XML-based vector files and should be diffable/mergeable. CodeRabbit review: Gitlawb#1550 (comment)
adityachaudhary99
left a comment
There was a problem hiding this comment.
Fixed the *.svg binary → *.svg text in b310ad3. SVGs are XML-based and should be diffable/mergeable — good catch.
|
Hey @jatmn - tiny config PR that prevents a nasty Windows/NTFS footgun. What: Why (my blunder): My earlier PR #1532 accidentally shipped +660k/-660k This PR: #1550 — 1 file, 125 lines, zero code changes. CodeRabbit review Would love a review when you have a chance. Happy to adjust anything. |
jatmn
left a comment
There was a problem hiding this comment.
I found an issue that needs to be addressed before this is ready.
Findings
- [P2] Renormalize existing CRLF TypeScript files before adding the rule
.gitattributes:7
The new*.ts textattribute is being added while the repository still contains TypeScript files whose index line endings are CRLF or mixed. In a fresh checkout of this PR branch with Windows-stylecore.autocrlf=true,git statusis dirty immediately with line-ending-only rewrites insrc/tools/WebSearchTool/providers/brave.ts,src/tools/WebSearchTool/providers/brave.test.ts, andsrc/tools/WebSearchTool/providers/exa.test.ts(89 +89,53 +53, and130 +130ingit diff --numstat). That means the PR currently creates the same kind of Windows checkout noise it is intended to prevent. Please include the matching renormalization for files affected by the new attributes, or otherwise adjust the attributes so a fresh Windows checkout stays clean.
The new *.ts text attribute exposed 3 TS files with CRLF in the index. Renormalizing so a fresh Windows checkout stays clean. Fixes jatmn's P2 finding.
|
@coderabbitai full review |
|
CodeRabbit chat interactions are restricted to organization members for this repository. Ask an organization member to interact with CodeRabbit, or set |
|
@coderabbitai run pre-merge check |
|
CodeRabbit chat interactions are restricted to organization members for this repository. Ask an organization member to interact with CodeRabbit, or set |
jatmn
left a comment
There was a problem hiding this comment.
Thanks for the update. I rechecked the previously discussed paths and do not see any remaining actionable issues from my side.
Per-file port of upstream 1c27957. 1 file (.gitattributes) only. Skipped 3 brave/exa file hunks — fork does not have `src/tools/WebSearchTool/providers/brave.ts` or `brave.test.ts`; the upstream commit was just renormalizing line endings in those files (no real code change), and exa.test.ts is not in the fork either. Applying those hunks would add the brave search provider, which is out of scope for the LF-eol config-only change. Source: upstream 1c27957
* feat: add .gitattributes to enforce LF line endings Prevents Windows/NTFS contributors with core.autocrlf=true from accidentally converting the entire codebase CRLF→LF, which produces PRs with +600k/-600k diffs across 700+ files. - * text=auto normalizes all text files to LF on checkin - Explicit binary markers for images, fonts, archives, compiled code - No code changes — config-only, zero risk * fix: treat SVGs as text, not binary SVGs are XML-based vector files and should be diffable/mergeable. CodeRabbit review: Gitlawb#1550 (comment) * fix: renormalize CRLF TypeScript files to LF The new *.ts text attribute exposed 3 TS files with CRLF in the index. Renormalizing so a fresh Windows checkout stays clean. Fixes jatmn's P2 finding.
Problem
openclaude has no
.gitattributes. Contributors on Windows/NTFS with defaultcore.autocrlf=truewill silently convert LF→CRLF on checkout. A subsequentgit add -Astages every file, producing PRs with +600k/-600k diffs across 700+ files.This already happened (see #1532 before cleanup) and will happen to every new Windows contributor.
Fix
Add a comprehensive
.gitattributesmatching the pattern used by openclaude-adjacent projects:* text=auto— normalize all text files to LF on checkinImpact
.gitattributesis repo-level and ships with every clone — no per-contributor setup neededTesting
git add .gitattributes && git commit— 1 file, 124 lines, clean diffSummary by CodeRabbit