mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-07 09:11:42 +00:00
chore: cleanup
This commit is contained in:
parent
dca2540ca7
commit
1a262c4ca8
2 changed files with 25 additions and 9 deletions
|
|
@ -385,6 +385,11 @@ export namespace Worktree {
|
|||
throw new ResetFailedError({ message: errorText(checkout) || `Failed to checkout ${target}` })
|
||||
}
|
||||
|
||||
const clean = await $`git clean -fd`.quiet().nothrow().cwd(entry.path)
|
||||
if (clean.exitCode !== 0) {
|
||||
throw new ResetFailedError({ message: errorText(clean) || "Failed to clean worktree" })
|
||||
}
|
||||
|
||||
const worktreeBranch = entry.branch?.replace(/^refs\/heads\//, "")
|
||||
if (!worktreeBranch) {
|
||||
throw new ResetFailedError({ message: "Worktree branch not found" })
|
||||
|
|
@ -395,6 +400,11 @@ export namespace Worktree {
|
|||
throw new ResetFailedError({ message: errorText(reset) || "Failed to reset worktree" })
|
||||
}
|
||||
|
||||
const cleanAfter = await $`git clean -fd`.quiet().nothrow().cwd(entry.path)
|
||||
if (cleanAfter.exitCode !== 0) {
|
||||
throw new ResetFailedError({ message: errorText(cleanAfter) || "Failed to clean worktree" })
|
||||
}
|
||||
|
||||
const branchReset = await $`git branch -f ${worktreeBranch} ${target}`.quiet().nothrow().cwd(entry.path)
|
||||
if (branchReset.exitCode !== 0) {
|
||||
throw new ResetFailedError({ message: errorText(branchReset) || "Failed to update worktree branch" })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue