fix(tui): keep worktrees out of projects (#50612)

This commit is contained in:
Shoubhit Dash
2026-09-22 17:35:00 +05:30
committed by GitHub
Unverified
parent 8e62ad7adc
commit 2f06f9d58b
2 changed files with 8 additions and 6 deletions
+5 -4
View File
@@ -213,10 +213,11 @@ export function DialogOpen(props: { sessions: SessionInfo[]; onLoad: (sessions:
project,
})),
),
...sessions().map((session) => ({
directory: session.location.directory,
project: data.project.get(session.projectID),
})),
...sessions().flatMap((session) => {
const project = data.project.get(session.projectID)
if (project && project.canonical !== "/") return []
return [{ directory: session.location.directory, project }]
}),
]
.filter((item) => {
const key = locationKey(item)
@@ -197,7 +197,7 @@ test("includes unique sandbox and recent session directories, including global p
}
})
test("shows nested Git session directories as projects and in their session footer", async () => {
test("keeps nested Git session directories out of projects and in their session footer", async () => {
const fixture = await renderOpen((url) => {
if (url.pathname === "/api/project")
return json([
@@ -205,6 +205,7 @@ test("shows nested Git session directories as projects and in their session foot
id: "proj_current",
canonical: "/tmp/opencode/project",
name: "OpenCode",
vcs: "git",
time: { created: 1, updated: 2 },
sandboxes: [],
},
@@ -232,7 +233,7 @@ test("shows nested Git session directories as projects and in their session foot
)
expect(frame).toContain("OpenCode · dashboard")
expect(frame).not.toContain("browse directories")
expect(frame).toContain("/tmp/opencode/project/packages/dashboard")
expect(frame).not.toContain("/tmp/opencode/project/packages/dashboard")
} finally {
await fixture.dispose()
}