From 7f1c6805973b944e228919ddd64e07e0e6136c9c Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Sat, 30 May 2026 09:40:58 -0700 Subject: [PATCH] Fix WSL workspace root detection Co-authored-by: Orca --- src/main/ipc/worktree-logic-wsl.test.ts | 15 +++++++++++++++ src/main/ipc/worktree-logic.ts | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/ipc/worktree-logic-wsl.test.ts b/src/main/ipc/worktree-logic-wsl.test.ts index 12c2f5121..d3c9eae4d 100644 --- a/src/main/ipc/worktree-logic-wsl.test.ts +++ b/src/main/ipc/worktree-logic-wsl.test.ts @@ -48,4 +48,19 @@ describe('computeWorktreePath WSL layout', () => { }) ).toBe(win32.join('C:\\workspaces', 'feature')) }) + + it('uses an explicit WSL UNC workspace root without remapping it', () => { + parseWslPathMock.mockReturnValue({ + distro: 'Ubuntu', + linuxPath: '/home/jin/src/repo' + }) + getWslHomeMock.mockReturnValue('\\\\wsl.localhost\\Ubuntu\\home\\jin') + + expect( + computeWorktreePath('feature', '\\\\wsl.localhost\\Ubuntu\\home\\jin\\src\\repo', { + nestWorkspaces: false, + workspaceDir: '\\\\wsl.localhost\\Ubuntu\\home\\jin\\custom-worktrees' + }) + ).toBe('\\\\wsl.localhost\\Ubuntu\\home\\jin\\custom-worktrees\\feature') + }) }) diff --git a/src/main/ipc/worktree-logic.ts b/src/main/ipc/worktree-logic.ts index 9e32c2650..ae8926c15 100644 --- a/src/main/ipc/worktree-logic.ts +++ b/src/main/ipc/worktree-logic.ts @@ -8,6 +8,7 @@ import type { WorktreeMeta } from '../../shared/types' import { resolveRuntimePath } from '../../shared/cross-platform-path' +import { isWslUncPath } from '../../shared/wsl-paths' import { splitWorktreeId } from '../../shared/worktree-id' import { DEFAULT_WORKSPACE_STATUS_ID } from '../../shared/workspace-statuses' import { getWslHome, parseWslPath } from '../wsl' @@ -234,7 +235,7 @@ function shouldMirrorWorkspaceDirInsideWsl(repoPath: string, workspaceDir: strin if (isWorkspaceDirRelativeToRepo(repoPath, workspaceDir)) { return false } - return !parseWslPath(workspaceDir) + return !isWslUncPath(workspaceDir) } /**