diff --git a/frontend/src/components/navigation/RepoQuickSwitchSheet.test.tsx b/frontend/src/components/navigation/RepoQuickSwitchSheet.test.tsx index 168ae372..5b81c7b5 100644 --- a/frontend/src/components/navigation/RepoQuickSwitchSheet.test.tsx +++ b/frontend/src/components/navigation/RepoQuickSwitchSheet.test.tsx @@ -110,6 +110,53 @@ describe('RepoQuickSwitchSheet', () => { }) }) + it('distinguishes worktrees of the same repo by branch', async () => { + vi.mocked(listRepos).mockResolvedValue([ + { + id: 1, + repoUrl: 'https://github.com/test/repo1.git', + localPath: '/path/to/repo1', + sourcePath: null, + currentBranch: 'main', + isLocal: false, + createdAt: new Date().toISOString(), + updatedAt: new Date().toISOString(), + }, + { + id: 2, + repoUrl: 'https://github.com/test/repo1.git', + localPath: '/path/to/repo1/.worktrees/feature-a', + sourcePath: null, + currentBranch: 'feature-a', + isWorktree: true, + isLocal: false, + createdAt: new Date().toISOString(), + updatedAt: new Date().toISOString(), + }, + { + id: 3, + repoUrl: 'https://github.com/test/repo1.git', + localPath: '/path/to/repo1/.worktrees/feature-b', + sourcePath: null, + currentBranch: 'feature-b', + isWorktree: true, + isLocal: false, + createdAt: new Date().toISOString(), + updatedAt: new Date().toISOString(), + }, + ]) + const handleClose = vi.fn() + render( + , + { wrapper: createWrapper() }, + ) + await waitFor(() => { + expect(screen.getAllByText('repo1')).toHaveLength(3) + expect(screen.getByText('feature-a')).toBeInTheDocument() + expect(screen.getByText('feature-b')).toBeInTheDocument() + }) + }) + it('does not show assistant as a repo option', async () => { vi.mocked(listRepos).mockResolvedValue([ { diff --git a/frontend/src/components/navigation/RepoQuickSwitchSheet.tsx b/frontend/src/components/navigation/RepoQuickSwitchSheet.tsx index 1ca7f066..d9e4c84c 100644 --- a/frontend/src/components/navigation/RepoQuickSwitchSheet.tsx +++ b/frontend/src/components/navigation/RepoQuickSwitchSheet.tsx @@ -8,7 +8,7 @@ import { Button } from '@/components/ui/button' import { cn, getRepoDisplayName } from '@/lib/utils' import { listRepos } from '@/api/repos' import { AddRepoDialog } from '@/components/repo/AddRepoDialog' -import { FolderGit2, Check, Plus } from 'lucide-react' +import { FolderGit2, Check, Plus, GitBranch } from 'lucide-react' import { useUrlParams } from '@/hooks/useUrlParams' import { ASSISTANT_REPO_ID } from '@opencode-manager/shared/utils' import { getAssistantPath, isAssistantPath } from '@/lib/navigation' @@ -123,6 +123,7 @@ export function RepoQuickSwitchSheet({ isOpen, onClose }: RepoQuickSwitchSheetPr
{filteredRepos.map((repo) => { const isActive = repo.id === activeRepoId + const branchToDisplay = repo.currentBranch || repo.branch return (
-
- {getRepoDisplayName(repo)} +
+
+ {getRepoDisplayName(repo)} +
+ {branchToDisplay && ( +
+ + {branchToDisplay} +
+ )}
{isActive && }