Fix WSL workspace root detection
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
parent
f5bf30ac57
commit
7f1c680597
|
|
@ -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')
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue