Skip to content

Commit 75853dc

Browse files
Fix branch creation condition and remove redundant null check
- Restore effectiveEnvMode === 'local' guard for canCreateBranch instead of !isSelectingWorktreeBase, which unintentionally allowed branch creation in worktree mode when env was locked or a worktree path was active. - Remove redundant !parsedReference check in handleConfirm's second guard, since the first guard already returns early when parsedReference is falsy. Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
1 parent 92462e7 commit 75853dc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

apps/web/src/components/BranchToolbarBranchSelector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export function BranchToolbarBranchSelector({
116116
const checkoutPullRequestItemValue = prReference && onCheckoutPullRequestRequest
117117
? `__checkout_pull_request__:${prReference}`
118118
: null;
119-
const canCreateBranch = !isSelectingWorktreeBase && trimmedBranchQuery.length > 0;
119+
const canCreateBranch = effectiveEnvMode === "local" && trimmedBranchQuery.length > 0;
120120
const hasExactBranchMatch = branchByName.has(trimmedBranchQuery);
121121
const createBranchItemValue = canCreateBranch
122122
? `__create_new_branch__:${trimmedBranchQuery}`

apps/web/src/components/ComposerPullRequestCommandMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export function ComposerPullRequestCommandMenu({
107107
setReferenceDirty(true);
108108
return;
109109
}
110-
if (!parsedReference || !resolvedPullRequest || !cwd) {
110+
if (!resolvedPullRequest || !cwd) {
111111
return;
112112
}
113113
setPreparingMode(mode);

0 commit comments

Comments
 (0)