Expand description
§zerogit
A lightweight, pure Rust Git client library.
This crate provides Git repository operations without external dependencies like libgit2 or the git command-line tool.
§Features
- Read Git repositories (loose objects only, no pack files yet)
- Navigate commits, trees, and blobs
- Read branches and HEAD
- Query working tree status
- Read index (staging area)
§Quick Start
use zerogit::{Repository, Result};
fn main() -> Result<()> {
// Open a repository
let repo = Repository::open("path/to/repo")?;
// Get HEAD
let head = repo.head()?;
println!("On branch: {:?}", head.branch_name());
// Read a commit
let commit = repo.commit(&head.oid().to_hex())?;
println!("Latest commit: {}", commit.summary());
// Check status
for entry in repo.status()? {
println!("{:?}: {}", entry.status(), entry.path().display());
}
Ok(())
}§Module Overview
Re-exports§
pub use error::Error;pub use error::Result;pub use repository::Repository;pub use objects::Blob;pub use objects::Commit;pub use objects::FileMode;pub use objects::Object;pub use objects::Oid;pub use objects::Signature;pub use objects::Tree;pub use objects::TreeEntry;pub use refs::Branch;pub use refs::Head;pub use status::FileStatus;pub use status::StatusEntry;pub use index::Index;pub use index::IndexEntry;