diff --git a/src/renderer/src/components/sidebar/DeleteWorktreeDialog.tsx b/src/renderer/src/components/sidebar/DeleteWorktreeDialog.tsx index 1e84f7532d9..872c1dae81a 100644 --- a/src/renderer/src/components/sidebar/DeleteWorktreeDialog.tsx +++ b/src/renderer/src/components/sidebar/DeleteWorktreeDialog.tsx @@ -34,6 +34,10 @@ const DeleteWorktreeDialog = React.memo(function DeleteWorktreeDialog() { const deleteError = deleteState?.error ?? null const canForceDelete = deleteState?.canForceDelete ?? false const worktreeName = worktree?.displayName ?? 'unknown' + // Why: the main worktree is the repo's original clone directory — `git worktree remove` + // always rejects it. We block the delete button upfront so the user doesn't have to + // discover this limitation via a confusing force-delete dead-end. + const isMainWorktree = worktree?.isMainWorktree ?? false useEffect(() => { if (isOpen && worktreeId && !worktree && !isDeleting) { @@ -127,7 +131,19 @@ const DeleteWorktreeDialog = React.memo(function DeleteWorktreeDialog() { )} - {deleteError && ( + {isMainWorktree && ( +