diff options
| author | Maharshi Patel <[email protected]> | 2026-02-06 17:18:03 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-06 16:18:03 -0600 |
| commit | 89064c34c502a82d44b78030cc9b522f7e5966be (patch) | |
| tree | 483b7b3ff2dc6df62b4a327f1fd19d804e859501 | |
| parent | fde0b39b7c97dacb78cb55f3d963aa54f61650ea (diff) | |
| download | opencode-89064c34c502a82d44b78030cc9b522f7e5966be.tar.gz opencode-89064c34c502a82d44b78030cc9b522f7e5966be.zip | |
fix(opencode): cleanup orphaned worktree directories (#12399)
| -rw-r--r-- | packages/opencode/src/worktree/index.ts | 7 |
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) |
