HydraGit Docs
v0.3.1

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.git extension (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

  1. The active (focused) repo is persisted per-workspace in workspaceState and restored on reload.
  2. The repo list + active root are pushed to both webviews as the repoState message; a freshly-mounted view pulls it once via repo.list.
  3. 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.

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.

  1. Webview send(cmd, params, repo?) → host goProcess.send(cmd, params, repo?) → Go's Request.Repo.
  2. The Go handler runs git against req.Repo when set, else the spawn-time HYDRAGIT_REPO. One process serves every repo.
  3. Host path-helpers (diff/open) also accept the repo root, so a diff opened from a non-focused group resolves against the right files.