Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/app/e2e/projects/workspace-new-session.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ test("new sessions from sidebar workspace actions stay in selected workspace", a
trackDirectory(second.directory)
await waitWorkspaceReady(page, second)

const firstSession = await createSessionFromWorkspace(page, first.slug, `workspace one ${Date.now()}`)
const firstSession = await createSessionFromWorkspace(page, first, `workspace one ${Date.now()}`)
trackSession(firstSession.sessionID, first.directory)

const secondSession = await createSessionFromWorkspace(page, second.slug, `workspace two ${Date.now()}`)
const secondSession = await createSessionFromWorkspace(page, second, `workspace two ${Date.now()}`)
trackSession(secondSession.sessionID, second.directory)

const thirdSession = await createSessionFromWorkspace(page, first.slug, `workspace one again ${Date.now()}`)
const thirdSession = await createSessionFromWorkspace(page, first, `workspace one again ${Date.now()}`)
trackSession(thirdSession.sessionID, first.directory)

await expect.poll(() => sessionDirectory(first.directory, firstSession.sessionID)).toBe(first.directory)
Expand Down
14 changes: 14 additions & 0 deletions packages/app/src/components/dialog-edit-project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ export function DialogEditProject(props: { project: LocalProject }) {
const start = store.startup.trim()

if (props.project.id && props.project.id !== "global") {
// Check if this is a sub-folder of a git project (worktree differs from git root).
// Sub-folder renames should be stored per-workspace, not shared across all worktrees.
const gitRoot = globalSync.data.project.find((x) => x.id === props.project.id)
const isSubfolder = gitRoot && props.project.worktree !== gitRoot.worktree
if (isSubfolder) {
globalSync.project.meta(props.project.worktree, {
name,
icon: { color: store.color, override: store.iconUrl || undefined },
commands: { start: start || undefined },
})
globalSync.project.icon(props.project.worktree, store.iconUrl || undefined)
dialog.close()
return
}
await globalSDK.client.project.update({
projectID: props.project.id,
directory: props.project.worktree,
Expand Down
7 changes: 6 additions & 1 deletion packages/app/src/context/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,12 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
}

const isGlobal = projectID === "global" || (metadata?.id === undefined && localOverride)
if (!isGlobal) return base
if (!isGlobal) {
// Allow per-workspace name override for git sub-folder workspaces.
// Without this, all sub-folders of the same repo share the project-level name.
if (local?.name !== undefined) return { ...base, name: local.name }
return base
}

return {
...base,
Expand Down
7 changes: 7 additions & 0 deletions packages/app/src/pages/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,13 @@ export default function Layout(props: ParentProps) {
const name = next === getFilename(project.worktree) ? "" : next

if (project.id && project.id !== "global") {
// Sub-folder renames should be stored per-workspace, not shared across all worktrees.
const gitRoot = globalSync.data.project.find((x) => x.id === project.id)
const isSubfolder = gitRoot && project.worktree !== gitRoot.worktree
if (isSubfolder) {
globalSync.project.meta(project.worktree, { name })
return
}
await globalSDK.client.project.update({ projectID: project.id, directory: project.worktree, name })
return
}
Expand Down
Loading