git-commits 0.1.0

Simple library for iterating git commits and changes
Documentation
  • Coverage
  • 19.23%
    5 out of 26 items documented1 out of 8 items with examples
  • Size
  • Source code size: 51.03 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.78 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 30s Average build duration of successful builds.
  • all releases: 27s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • vallentin/git-commits
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • vallentin

git-commits

Latest Version Docs License

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) => {}
        // }
    }
}