⬡Multi-repo workspaces
One HydraGit window, many repositories. When a workspace contains more than one git repo (multi-root folders or a nested repo), the sidebar shows each as its own collapsible group — VS Code's native Source Control layout — while the main panel (log graph, branch tree, diff) follows whichever repo you focus.
Repo discovery RepoService
Where repos come from
- Built-in Git APIDiscovery leans on VS Code's
vscode.gitextension (getAPI(1).repositories), kept live via onDidOpenRepository / onDidCloseRepository — it finds multi-root and nested repos. - Fallback scanIf the built-in Git extension is unavailable, HydraGit scans each workspace folder for a
.git.
What happens next
- The active (focused) repo is persisted per-workspace in
workspaceStateand restored on reload. - The repo list + active root are pushed to both webviews as the repoState message; a freshly-mounted view pulls it once via repo.list.
- Single-repo workspaces are unaffected — the grouping UI and status-bar switcher stay hidden.
Grouped sidebar RepoGroup
Each repo renders as its own section: a header (name · branch · change count), its conflict banner, its changed-files tree, and its own commit area. Staging and committing in a group are scoped entirely to that repo.
- Click the header line to expand / collapse the group (and focus the repo).
- Each group polls its own status every 3 seconds and re-renders only when something actually changed.
- With a single repo the header is hidden and the view stays flat — identical to the classic sidebar.
Focus & the main panel
Clicking a group focuses its repo. Focus is the active repo, so the main panel — log graph, branch tree, diff — repaints to show the focused repo's history. One graph at a time, driven by which group you touch.
Status-bar breadcrumb repo.pick
The main panel's bottom status bar shows repo ▸ branch for the focused repo. Clicking the repo segment opens the native repo quick-pick (repo.pick). VS Code's own status bar also carries a $(repo) switcher (hydragit.selectRepo) that survives any panel being closed.
Per-repo command scoping
Every IPC request carries an optional repo root. The grouped sidebar stamps each group's root so it can read and commit a specific repo without changing focus; when omitted the request falls back to the focused repo, then to the Go process's spawn default.
- Webview
send(cmd, params, repo?)→ hostgoProcess.send(cmd, params, repo?)→ Go'sRequest.Repo. - The Go handler runs
gitagainstreq.Repowhen set, else the spawn-timeHYDRAGIT_REPO. One process serves every repo. - Host path-helpers (diff/open) also accept the repo root, so a diff opened from a non-focused group resolves against the right files.