`git worktree list` prints the same POSIX spelling as `rev-parse
--show-toplevel` when it runs inside the distribution, so in a WSL workspace
every linked checkout arrived as `/home/...`. That broke the worktree selector
in two ways at once: `current` compared a POSIX entry against the now-UNC
current root and never matched (so no checkout was marked as the current one),
and `resolveWorktree` handed the POSIX entry back as a command target, which
the Windows git then refused.
Re-spell in `listedWorktrees()`, the single place both the inventory
(`worktrees()`) and the selector (`resolveWorktree()`) read from.
Refs #1189
`rev-parse --show-toplevel` runs INSIDE the distribution (wslLaunch), so it
names the repository with a POSIX path — `/home/me/repo` for a
`\\wsl.localhost\Ubuntu\home\me\repo` cwd. wslLaunch only recognises the UNC
spelling, so every later command on that root fell through to the Windows git
and died with `cannot change to '/home/me/repo'`: `git.status`, `diff`, `log`,
`blame`, `stage` and `commit` all resolve their base through
`repoRoot()` → `runGit(root, …)`, so the whole Git panel read as "failed to
load" while the file tree and the editor stayed fine.
Re-spell the reported root through the cwd it was discovered from. The
function reproduces the share the cwd arrived on (`wsl.localhost` or the
legacy `wsl$`), which is why WSL_UNC_ROOT now captures it; wslLaunch reads the
same groups, so there is still one spelling of the UNC shape in this file.
Refs #1189
The git binary on the Windows PATH is a Windows build. Pointed at a
`\wsl.localhost\<distro>\…` worktree it reaches every file through the 9P
file server, one `stat` per worktree file. Measured on a 3 102-file
repository: `git status` did not finish in 180 s, `git diff --numstat`
did not finish in 25 s — while the SAME argv inside the distribution
answered in 0.47 s. The panel retried on timeout, and each retry left an
orphaned `git.exe` behind, so the source-control tab never loaded.
`spawnGit` now reads the distribution and POSIX path out of a UNC cwd
(`wslLaunch`, accepting `\wsl.localhost\`, the legacy `\wsl$\` share and
the forward-slash spelling) and, for those cwds only, launches
`wsl.exe -d <distro> --cd <path> -e git …` with the `-C <cwd>` prefix
replaced by `--cd`. `-e`, not `--`: the `--` form re-parses the tail as a
shell command line, which mangles `%(refname:short)` and anything else
carrying `()`/`[]`. `WSLENV` carries `LC_ALL`/`GIT_OPTIONAL_LOCKS` across
the boundary, which wsl.exe otherwise drops.
Everything else is untouched and shares one code path: the timeout, the
stdout/stderr byte caps, the NUL field cap, `killTree()` (which reaps the
distribution-side process too), the error strings and the
dubious-ownership retry. A non-UNC cwd spawns exactly the argv it always
did.
dev added `-c core.quotePath=false` to every git invocation, which shifts
both pinned argv shapes and makes the positional `slice(5, 7)` in the
cwd-fallback case read the wrong pair. Name the flag set instead of counting
positions — the file's own subcommandOf() comment already says counting
breaks on every added `-c`.
git emits no ---/+++ for a binary file, a pure rename and a mode-only
change, and parseUnifiedDiff only ever read paths from those two lines.
The section therefore kept oldPath/newPath === '', so DiffFiles drew a
header carrying just the binary badge and no file name (sandwiched
between two .md rows, which is exactly how it reads as if those .md files
were the binary ones), and a pure rename / mode-only change collapsed to
an empty disabled button (no path, and fileTag cannot see a rename).
Recover the paths in order of authority: ---/+++ when present, else the
section's own `rename from|to`, `Binary files A and B differ`, or the
`diff --git` header. Only the mode-only shape needs the last one: it takes
the ` b/` whose two sides name the same file, and leaves the path empty
rather than guessing. ---/+++ values also lose the TAB git appends to a
spaced path, and decodeGitPath undoes git's C-quoting so diff text from a
default-quotePath source still renders the real file name.
runGit gains `-c core.quotePath=false` for the same reason at the source:
git's default turns a space/CJK path into an octal-escaped quoted string,
which every diff surface then renders as the file name. The `-z`-framed
porcelain callers are unaffected (git never quotes NUL-framed output).
Verified against taktop_redo 8b4b933, the commit whose three .jpg rows
rendered as bare badges: all three now carry their full path, and real git
output for space/CJK paths parses with no escapes and no trailing TAB.
New tests: tests/diff-binary-row.spec.tsx (rendered rows) and the path
matrix in tests/diff-rows.spec.ts; tests/git-spawn.spec.ts now derives the
subcommand from runGit's prefix instead of counting its flags.
tests/git.spec.ts had pinned the empty path (`oldPath === ''`) as the known
behaviour of a mode/rename-only section; it now asserts the recovered paths
instead, and the binary section there asserts its own name too.