chore: cleanup

This commit is contained in:
Adam
2026-01-15 17:34:38 -06:00
parent dca2540ca7
commit 1a262c4ca8
2 changed files with 25 additions and 9 deletions

View File

@@ -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" })