Handle reset failure gracefully when squash produces no changes

The reset during early exit could throw if the worktree is already in a
conflicted state, masking the real "no changes" diagnostic.
This commit is contained in:
Chris Wanstrath 2026-04-10 08:58:45 -07:00
parent 106ff20de7
commit f226f30e6f

View File

@ -35,7 +35,7 @@ export async function action(branch: string) {
const diff = await git.diffStaged(worktree)
if (!diff.trim()) {
await git.resetSoft(originalHead, worktree)
await git.resetSoft(originalHead, worktree).catch(() => {})
spin.fail("No changes after squash")
process.exit(1)
}