Crate zerogit

Crate zerogit 

Source
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

  • error - Error types and Result alias
  • repository - Main Repository type for accessing Git data
  • objects - Git object types (blob, tree, commit)
  • refs - References (HEAD, branches)
  • index - Index (staging area) operations
  • status - Working tree status

Re-exports§

pub use config::Config;
pub use config::ConfigLevel;
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 refs::RemoteBranch;
pub use refs::Tag;
pub use status::FileStatus;
pub use status::StatusEntry;
pub use index::Index;
pub use index::IndexEntry;
pub use log::LogOptions;
pub use diff::DiffDelta;
pub use diff::DiffStats;
pub use diff::DiffStatus;
pub use diff::TreeDiff;

Modules§

config
Git configuration file parsing and access.
diff
Tree diff implementation.
error
Error types for zerogit.
index
Git index (staging area) operations.
log
Git commit log iteration.
objects
Git object types (blob, tree, commit, tag).
refs
Git references (HEAD, branches, tags).
repository
Git repository operations.
status
Git status implementation.