Skip to content

Commit 03d304b

Browse files
author
opencode
committed
fix(gui-extensions): stop offering worktree actions without a repository
The session details menu offered worktree actions for a project whose directory holds no git repository, where creating one can only fail. Offer the menu only for a git project.
1 parent 39e0657 commit 03d304b

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎packages/gui-extensions/src/details/panel.tsx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ export default function SessionDetailsPanel(props: DetailsPanelProps) {
5050
// A subagent shares its parent's workspace, so it shows where it runs but cannot move on its own.
5151
const subagent = () => !!data().session.get(props.session.id)?.parentID
5252

53+
// Worktrees belong to a git project. Creating, switching and returning to Local all
54+
// work from the project's own checkouts, so nothing about the session's directory
55+
// gates the menu.
56+
const movable = () => props.project.vcs === "git"
57+
5358
const workspace = () => (
5459
<>
5560
<Icon name={props.session.local ? "monitor" : "outline-worktree"} class="shrink-0 text-v2-icon-icon-muted" />
@@ -70,7 +75,7 @@ export default function SessionDetailsPanel(props: DetailsPanelProps) {
7075
expanded={props.disclosure.project()}
7176
onExpandedChange={props.disclosure.setProject}
7277
>
73-
<Show when={!subagent()} fallback={<div class="session-summary-row">{workspace()}</div>}>
78+
<Show when={!subagent() && movable()} fallback={<div class="session-summary-row">{workspace()}</div>}>
7479
<SessionWorkspaceMenu
7580
session={props.session}
7681
project={props.project}
@@ -131,6 +136,7 @@ export default function SessionDetailsPanel(props: DetailsPanelProps) {
131136
<Show
132137
when={
133138
!subagent() &&
139+
movable() &&
134140
props.disclosure.project() &&
135141
props.session.local &&
136142
props.diffs?.length &&

0 commit comments

Comments
 (0)