Expand description
vcs-core — a unified facade over vcs-git and vcs-jj.
Two pieces both downstream tools kept re-implementing:
detect— walk up from a directory to find a.git/.jjrepository (jj wins when colocated), returning theBackendKindand root.Repo— a cwd-bound handle that dispatches the common VCS operations (status, diff stat, partial commit, worktree create/remove, …) to whichever backend is present, returning backend-agnostic DTOs. Open it once withRepo::open; re-anchor it to another directory withRepo::atwithout threading adirargument through every call.
Tool-specific operations stay on the underlying typed clients, reachable via
the Repo::git / Repo::jj escape hatches.
use vcs_core::Repo;
let repo = Repo::open(".")?;The handle is generic over the ProcessRunner so tests can inject a fake;
Repo::open uses the real job-backed runner.
Re-exports§
Structs§
- Diff
Stat - Aggregate insertion/deletion counts for the working copy.
- File
Change - One changed path in the working copy, unified across
git status/jj diff --summary. - Located
- The result of
detect: which backend, and the repository root it was found at. - Repo
- A cwd-bound, backend-agnostic VCS handle. Operations run against the bound
directory (
cwd); useatto get a sibling handle bound elsewhere. - Worktree
Info - One attached worktree (git) / workspace (jj).
Enums§
- Backend
Kind - Which version-control tool backs a
Repo. - Change
Kind - How a file changed in the working copy.
- Create
Outcome - How a worktree was materialised. The facade always reports
Plain; theCowClonedvariant exists so a consumer that layers a copy-on-write strategy on top can reuse this type. - Error
- An error from a
Repooperation.
Functions§
- detect
- Walk up from
startto the filesystem root looking for a repository. A.jjdirectory wins over.git(colocated repos are driven through jj);.gitmay be a directory or a gitlink file (a linked worktree/submodule). Pure filesystem probing — no subprocess.