Skip to content

fix(app): ignore CRLF and symlink type changes on Windows - #27277

Closed
Kesuan wants to merge 2 commits into
anomalyco:devfrom
Kesuan:dev
Closed

Kesuan wants to merge 2 commits into
anomalyco:devfrom
Kesuan:dev

Conversation

@Kesuan

@Kesuan Kesuan commented May 13, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #27276

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

On Windows, the Review window and Changes tab show many files as "Modified" even though they have no actual content changes. Two root causes in the hardcoded git config (packages/opencode/src/git/index.ts):

  1. core.autocrlf=false conflict — Windows defaults to core.autocrlf=true, which converts LF→CRLF on checkout. The VCS layer overrides this to false, so git diff compares CRLF working trees against LF repository blobs literally, marking every text file as modified.
  2. core.symlinks=true on a non-symlink filesystem — There are 62 symlink files in the repository. Windows does not natively support symlinks, so they are checked out as regular files. Forcing core.symlinks=true makes git diff detect these as type changes (T) and report them as modified.

Fixes:

  • git/index.ts: Remove -c core.symlinks=true from the config array so git uses the platform default (true on macOS/Linux, false on Windows). Add --ignore-cr-at-eol to all 6 git diff commands so git ignores carriage-return at end-of-line during comparison.
  • file/index.ts: Add --ignore-cr-at-eol to the two git diff commands used by the file tree Changes tab (diff --numstat HEAD and diff --name-only --diff-filter=D HEAD), which run independently of the git layer's config.

How did you verify your code works?

  • CRLF fix: Before the fix, all text files appeared modified. After adding --ignore-cr-at-eol, only genuinely changed files show. Confirmed by comparing git diff --name-status HEAD output with and without the flag — the file count dropped from hundreds to single digits on a Windows machine with core.autocrlf=true.
  • Symlink fix: Before the fix, git -c core.symlinks=true diff --name-status HEAD listed all 62 symlink files as type changes (T). After removing the override, only actually modified files (like the replaced icon.png) appear.
  • Binary files: Replaced sdks/vscode/images/icon.png and confirmed the change shows correctly — binary file modifications are not affected by either fix.
  • Cross-platform: core.symlinks defaults to true on macOS/Linux, so removing the override has zero effect there. --ignore-cr-at-eol is a no-op on platforms without CRLF working trees.

Screenshots / recordings

N/A — this is a git layer logic fix, not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Git diff shows unmodified files as "Modified" on Windows (CRLF + symlink type changes)

1 participant