Expand description
vcs-git — automate Git from Rust through CLI process execution.
Async, mockable, and structured-error: consumers depend on the GitApi
trait and substitute a mock for the real Git client in tests. Commands
run inside an OS job (via processkit) so a git subprocess is never
orphaned, and honour an optional timeout.
use vcs_git::{Git, GitApi};
use std::path::Path;
let branch = git.current_branch(Path::new(".")).await?;Two test seams: enable the mock feature for a mockall-generated
MockGitApi, or inject a fake runner with
Git::with_runner(ScriptedRunner).
Structs§
- Branch
- A local branch from
git branch. - Commit
- A commit, parsed from a
\x1f-delimitedgit logline. - Git
- The real Git client. Generic over the
ProcessRunnerso tests can inject a fake process executor;Git::new()uses the real job-backed runner. - Process
Result - The captured result of running a process to completion.
- Status
Entry - One entry from
git status --porcelain=v1 -z(XY <path>, NUL-delimited).
Enums§
- Error
- Errors produced when launching or running a child process.
Constants§
- BINARY
- Name of the underlying CLI binary this crate drives.
Traits§
- GitApi
- The Git operations this crate exposes — the interface consumers code against and mock in tests.
Type Aliases§
- Result
- Crate result alias.