Repository navigation
Conversation
|
Also likely related: #33750 |
On Windows core.autocrlf=false forces literal CRLF/LF comparison between working tree and index. This makes git diff report every line as changed when only line endings differ. Adding --ignore-cr-at-eol to all git diff/patch commands makes CRLF differences transparent in diff display, so a 1-line edit shows as +/-1 instead of +/-1000.
|
Thanks for working on this. I think adding --ignore-cr-at-eol is a workaround rather than addressing the root cause. The Git service currently overrides repository/user configuration with: On Windows, this can conflict with a checkout using core.autocrlf=true and core.symlinks=false. The former causes CRLF-only false positives, while the latter causes symlink placeholders such as packages/docs/openapi.json and various PNG/ICO/SVG/manifest files to appear as type changes or deletions. These files are stored as mode 120000 in Git. --ignore-cr-at-eol also only affects git diff; git status can remain inconsistent, and legitimate CR changes may be hidden. A more complete fix would be to stop overriding these two settings and let Git respect the repository/user configuration: const cfg = [
"--no-optional-locks",
- "-c",
- "core.autocrlf=false",
"-c",
"core.fsmonitor=false",
"-c",
"core.longpaths=true",
- "-c",
- "core.symlinks=true",
"-c",
"core.quotepath=false",
] as constIt would also be useful to add regression tests for a CRLF checkout with core.autocrlf=true and a symlink placeholder checkout with core.symlinks=false. This should fix both issues without changing the intended diff semantics. |
|
As much as I wanted it fixed, It's sadly not going to happen. They ignore most PRs here. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #27276, Closes #30357
Type of change
What does this PR do?
On Windows, the Review window and Changes tab show modified files as if the entire file was rewritten. The root cause is the hardcoded
core.autocrlf=falseinpackages/opencode/src/git/index.ts.Windows defaults to
core.autocrlf=true, which converts LF->CRLF on checkout. The VCS layer overrides this tofalse, sogit diffcompares CRLF working trees against LF repository blobs literally, marking every text file line as changed.Fix: Add
--ignore-cr-at-eolto all 4git diffcommands ingit/index.tsso git ignores carriage-return at end-of-line during comparison. This makes a single-line edit in a 1000-line file show as +1/-1 instead of +1000/-1000.How did you verify your code works?
--ignore-cr-at-eolmakes git treat\r\nand\nas identical in diff computation. Affects all diff modes:--name-status,--numstat,--patch(single and bulk).Screenshots / recordings
N/A
Checklist