2 unstable releases
| 0.1.0 | May 23, 2025 |
|---|---|
| 0.0.1 | May 28, 2023 |
#467 in Development tools
79 downloads per month
30KB
733 lines
git-commits
Abstraction of git2 providing a simple interface
for easily iterating over commits and changes in a
Git repository.
In short, both git log --name-status and
git log --stat --format=fuller can be
implemented with just a handful of lines.
Example
let repo = git_commits::open("path-to-repo")?;
for commit in repo.commits()? {
// The `commit` contains the message, author, committer, time, etc
let commit = commit?;
println!("\n{}", commit);
for change in commit.changes()? {
// The `change` contains change kind, old/new path, old/new sizes, etc
let change = change?;
println!(" {}", change);
// match change {
// Change::Added(change) => {}
// Change::Modified(change) => {}
// Change::Deleted(change) => {}
// Change::Renamed(change) => {}
// }
}
}
Dependencies
~12MB
~270K SLoC