Available on crate feature
workflow only.Expand description
Walk a repository’s commit history into typed Commit structs.
Reached through Repository::history, which returns a HistoryWalk
builder. Configure with revision, max_count, since, author, etc.,
then call HistoryWalk::execute to spawn git log with a stable
--format and parse the output into Vec<Commit>.
use git_spawn::Repository;
let repo = Repository::open("/path/to/repo")?;
// Last 20 commits authored by Alice.
let commits = repo
.history()
.max_count(20)
.author("Alice")
.execute()
.await?;
for c in commits {
println!("{} {} {}", c.short_sha, c.author_name, c.subject);
}Parsing reuses the crate::parse::parse_log machinery and the
crate::parse::LOG_FORMAT token string. Commit is a re-export of
crate::parse::CommitEntry under a friendlier name for the workflow API.
Re-exports§
pub use crate::parse::CommitEntry as Commit;
Structs§
- History
Walk - Builder for one history walk. Configure with the chained setters, then
call
execute.