mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
* fix(cli): preserve WSL cwd through the Windows bridge (#6965) # Conflicts: # src/cli/index.test.ts # src/cli/index.ts * fix(cli): preserve bridge exit codes (#6965) * fix(cli): harden WSL cwd bridge compatibility * chore(cli): align cwd tests with main * fix(cli): repair deleted WSL cwd before path conversion * chore: preserve main formatting after merge --------- Co-authored-by: Brennan Benson <brennanbenson@Brennans-MacBook-Pro.local> Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
This commit is contained in:
co-authored by
Brennan Benson
Brennan Benson
parent
53a09afbef
commit
f90cd6ebc9
+5
-10
@@ -1,4 +1,4 @@
|
||||
import { isAbsolute, relative, resolve as resolvePath } from 'node:path'
|
||||
import { resolve as resolvePath } from 'node:path'
|
||||
import type {
|
||||
ComputerAppQuery,
|
||||
RuntimeWorktreeListResult,
|
||||
@@ -43,14 +43,6 @@ function assertLocalCwdWorktreeSelector(selector: string, client: RuntimeClient)
|
||||
)
|
||||
}
|
||||
|
||||
function isWithinPath(parentPath: string, childPath: string): boolean {
|
||||
if (isPathInsideOrEqual(parentPath, childPath)) {
|
||||
return true
|
||||
}
|
||||
const relativePath = relative(parentPath, childPath)
|
||||
return relativePath === '' || (!relativePath.startsWith('..') && !isAbsolute(relativePath))
|
||||
}
|
||||
|
||||
export async function resolveCurrentWorktreeSelector(
|
||||
cwd: string,
|
||||
client: RuntimeClient
|
||||
@@ -65,7 +57,10 @@ export async function resolveCurrentWorktreeSelector(
|
||||
let enclosingPathLength = -1
|
||||
for (const worktree of worktrees.result.worktrees) {
|
||||
const worktreePath = resolvePath(worktree.path)
|
||||
if (!isWithinPath(worktreePath, currentPath) || worktreePath.length <= enclosingPathLength) {
|
||||
if (
|
||||
!isPathInsideOrEqual(worktreePath, currentPath) ||
|
||||
worktreePath.length <= enclosingPathLength
|
||||
) {
|
||||
continue
|
||||
}
|
||||
enclosingWorktree = worktree
|
||||
|
||||
Reference in New Issue
Block a user