Repository navigation
fix(#1491): new-feature.sh exits 1 when the issue's local branch exists without a worktree, while sequant run reuses the branch - #1517
Merged
admarble merged 3 commits intoOct 19, 2026
Conversation
…rktree has it Check the branch out as is, like ensureWorktree, instead of exiting 1. Match the existing worktree exactly. Entire-Checkpoint: 8799a05c2fe6
Entire-Checkpoint: 00d38a74ca6a
…ts-1-when-the-issue
admarble
deleted the
feature/1491-fix-worktree-new-feature-sh-exits-1-when-the-issue
branch
October 19, 2026 00:35
Closed
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the issue's local branch exists and no worktree has it checked out,
new-feature.shnow creates the worktree on that branch as is and exits 0, instead of exiting 1 with advice. This matchesensureWorktree's existing-branch rule: no fetch, no reset, and neverorigin/<branch>. A recordedsequantBaseon the existing branch is kept. The worktree lookup now matches the branch ref exactly, sofeature/7-xis not taken forfeature/7-xy. A branch already checked out in a worktree and a new branch behave as before.scripts/new-feature.shis a symlink totemplates/scripts/new-feature.sh, so there is one copy.Fixes #1491
Verification
The tests drive the real script with
ghstubbed.npx vitest run __tests__/new-feature-existing-branch.integration.test.ts -t "local branch without a worktree"→ 1 passed, 0 failed.-t "existing-branch parity"→ 3 passed, 0 failed.-t "worktree already checked out"→ 2 passed;npx vitest run __tests__/new-feature-worktree-root.integration.test.ts __tests__/new-feature-checkout-guard.integration.test.ts→ 7 passed, 0 failed.Mutation-verified: AC-1 — restored the exit 1 advice branch for a local branch without a worktree; tests/new-feature-existing-branch.integration.test.ts > new-feature.sh existing local branch (#1491) > local branch without a worktree: creates the worktree on it and exits 0 failed, along with the 3 parity cases and the longer-name case, which take the same path (5 failed); restored.
Mutation-verified: AC-2 — made the existing-branch path start from origin/ when it exists; tests/new-feature-existing-branch.integration.test.ts > new-feature.sh existing local branch (#1491) > existing-branch parity > local branch behind origin/ -> local tip, not origin's failed (1 failed, 6 passed); restored.
🤖 Generated with Claude Code