Repository navigation
Conversation
…st repo
A repo opened from \wsl.localhost always runs Linux Git, but Orca rewrote
`sub\file` to `sub/file` only when the project's runtime setting said WSL.
With the default (Windows) setting, staging a file in a subfolder failed and
discarding one reported success while changing nothing.
validateGitRelativeFilePath now returns the path as Git spells it ("/" on every
host). On Windows "\" can only be a separator, and Windows Git accepts "/", so
this holds whatever the project setting or routing. literalPathspec drops its
setting-dependent rewrite: a "\" reaching it is a POSIX filename character.
Also fixes nested ignored-path checks and drive-checkout suspect matching in
WSL repos, which received backslash paths the same way.
Fixes #28422
Fixes #22251
Co-authored-by: Naveen Chatlapalli <naveen.aifanatic@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
ELI5
Git always writes folder paths with forward slashes (
.claude/settings.json). Windows writes them with backslashes (.claude\settings.json). Orca checked file paths using Windows rules and handed the backslash version to Git. Git for Windows doesn't mind, but Git inside WSL treats a backslash as part of the file name, so it went looking for a file literally called.claude\settings.json. Now Orca always hands Git forward slashes.What Changed
Before, in a repo opened from a
\wsl.localhost\<distro>\...path whose project runtime is Windows (the default for a newly added project):fatal: pathspec ':(literal).claude\settings.json' did not match any files. Bulk stage failed the same way.After: all of these work, whatever the project's runtime setting says.
Mechanism. Two separate decisions disagreed:
\wsl.localhostcwd runs Linux Git (resolveCommand).\→/rewrite inliteralPathspeckeyed offoptions.wslDistro, which is set only when the project's runtime setting resolves to WSL.This PR removes the second decision instead of syncing it with the first:
validateGitRelativeFilePath, the IPC boundary every Source Control call goes through, now returns the path as Git spells it:/-separated on every host. On Windows a\can only be a separator, so the rewrite is always correct. On POSIX,sepis already/, so a literal\in a filename is untouched.literalPathspecno longer rewrites anything and drops its options parameter. A\reaching it is a POSIX filename character. The runtime RPC boundary (normalizeRuntimeRelativePath) already sends/paths.Side fixes from the same root cause:
git:checkIgnoredin WSL repos sent backslash paths on stdin, so nested ignored files were never dimmed./paths, so it never matched subfolder files.Why
Alternatives considered:
worktreePaththrough every pathspec call and still ties correctness to routing. It also missescheckIgnored, which doesn't build pathspecs.Normalizing once, at the boundary where the Windows spelling enters, is the smallest change that's correct for every route. Windows Git accepts
/in:(literal)pathspecs; I checked with Git 2.55 for Windows.Linked Issue
Fixes #28422
Fixes #22251
Supersedes #28478. Thanks @1aifanatic for the diagnosis and the
wsl.localhost/wsl$test cases; credited as co-author.Visual Proof
Isolated dev Orca, CDP screenshots of a hidden window. Scratch repo inside WSL (Ubuntu-24.04), opened via its
\wsl.localhostpath, project runtime left at the default.Before: clicking + on
.claude/settings.json:After: same click, the file is staged:
Testing
Manual, on Windows 11 + WSL2 Ubuntu-24.04, in an isolated dev profile (
ORCA_BACKGROUND_LAUNCH=1, CDP only):git statusinside WSL confirms each result.C:\: stage, unstage and discard of a subfolder file all work with/paths..claude/settings.json, with no error toast.Automated:
filesystem-auth.test.ts: Windows path semantics through apath.win32mock, covering\wsl.localhost,\wsl$andC:\. A POSIX test checks that a backslash stays a filename character.status-wsl-pathspecs.test.tswas rewritten for the new contract: the Git layer passes paths through, with or withoutwslDistro./paths instead ofpath.join.tc:nodeandcheck:code-quality:changedpass.origin/main(CRLF line endings, symlink permissions). No new failures.Review
Agent skill upstream boundary
Notes
sepis/, so POSIX filenames containing\are unchanged (see [Bug]: Bulk discard confuses literal backslashes with POSIX separators #27133 / fix(git): preserve POSIX discard paths on execution hosts #27757).normalizeRuntimeRelativePath, which already sends/paths, so they are unchanged.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)