summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/opencode/src/worktree/index.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/opencode/src/worktree/index.ts b/packages/opencode/src/worktree/index.ts
index b0dfd57dd..2e095136e 100644
--- a/packages/opencode/src/worktree/index.ts
+++ b/packages/opencode/src/worktree/index.ts
@@ -411,8 +411,13 @@ export namespace Worktree {
if (key === directory) return item
}
})()
+
if (!entry?.path) {
- throw new RemoveFailedError({ message: "Worktree not found" })
+ const directoryExists = await exists(directory)
+ if (directoryExists) {
+ await fs.rm(directory, { recursive: true, force: true })
+ }
+ return true
}
const removed = await $`git worktree remove --force ${entry.path}`.quiet().nothrow().cwd(Instance.worktree)