mirror of
https://github.com/stablyai/orca.git
synced 2026-10-24 00:04:01 +00:00
Builds on @hwantage's fix: `git -c core.longpaths=true` only helped the plain `worktree add`, so two deep-path cases still failed with "Filename too long". - Sparse creation: `worktree add --no-checkout` writes no files, so the flag now also rides the `sparse-checkout set` and `checkout <branch>` calls that actually materialize the tree. Without it the failure landed after the worktree existed and rolled the whole create back. - SSH: relay addWorktreeOp builds its own argv, so a Windows SSH host was never covered. It now keys off the execution host's platform, not the client's, and the hardcoded --no-checkout splice index is offset by the prefix. - Predicate is now the cwd (`\\wsl.localhost\...` opts out) rather than the wslDistro option, which is not what decides which git binary runs. Scope stays command-level `-c`; no user, repo, or system config is written.
30 lines
987 B
TypeScript
30 lines
987 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { windowsLongPathGitArgs } from './windows-long-path-git-args'
|
|
|
|
describe('windowsLongPathGitArgs', () => {
|
|
it('enables long paths for a Windows drive path', () => {
|
|
expect(windowsLongPathGitArgs('C:\\Users\\dev\\repo', 'win32')).toEqual([
|
|
'-c',
|
|
'core.longpaths=true'
|
|
])
|
|
})
|
|
|
|
it.each(['darwin', 'linux'] as const)('returns nothing on %s', (platform) => {
|
|
expect(windowsLongPathGitArgs('/home/dev/repo', platform)).toEqual([])
|
|
})
|
|
|
|
it.each(['\\\\wsl.localhost\\Ubuntu\\home\\dev\\repo', '\\\\wsl$\\Ubuntu\\home\\dev\\repo'])(
|
|
'returns nothing for the WSL UNC path %s',
|
|
(cwd) => {
|
|
expect(windowsLongPathGitArgs(cwd, 'win32')).toEqual([])
|
|
}
|
|
)
|
|
|
|
it('never mutates the shared constant', () => {
|
|
const first = windowsLongPathGitArgs('C:\\repo', 'win32')
|
|
first.push('--bogus')
|
|
expect(windowsLongPathGitArgs('C:\\repo', 'win32')).toEqual(['-c', 'core.longpaths=true'])
|
|
})
|
|
})
|