Available on crate feature
workflow only.Expand description
Repository overview in a single call.
RepoInfo folds together the bits most automation reaches for first —
current branch, upstream tracking, default branch, dirty state, ahead/behind
counts — and is produced by Repository::info.
Behind a single call we run git status --porcelain=v2 --branch (which
emits a stable header with branch / upstream / ab counts plus per-file
entries) and git symbolic-ref refs/remotes/origin/HEAD for the default
branch. The default-branch lookup fails silently when there is no origin
remote yet — the field stays None rather than surfacing an error.
§Example
use git_spawn::Repository;
let repo = Repository::open("/path/to/repo")?;
let info = repo.info().await?;
if info.dirty {
eprintln!("uncommitted changes on {}", info.branch.as_deref().unwrap_or("(detached)"));
}
if info.behind > 0 {
eprintln!("{} commits behind {}", info.behind, info.upstream.as_deref().unwrap_or("upstream"));
}Structs§
- Repo
Info - Snapshot of a repository’s state.