Skip to main content

rskit_git/
lib.rs

1//! Composable git repository interfaces backed by libgit2 and the git CLI.
2//!
3//! This crate provides capability-based traits for git operations:
4//! - [`Repository`] and [`Executor`] for core repository access and raw CLI execution
5//! - [`Differ`], [`IgnoreReader`], [`TreeReader`], [`LogReader`], [`Blamer`],
6//!   and [`Inspector`] for read flows
7//! - [`IndexManager`], [`Committer`], and related write traits for mutating operations
8//! - [`RefManager`], [`RemoteManager`], [`ConfigReader`], and [`Maintainer`] for management
9//!
10//! The default backend uses `git2` (libgit2) for embedded operations
11//! and delegates several core mutating operations (merge, rebase, checkout, reset, stash, cherry-pick, maintenance) to the `git` CLI binary.
12//! **A `git` binary must be available on `PATH` at runtime.** Network operations (fetch, push) use the embedded `git2` backend.
13//!
14//! # Usage
15//!
16//! ```no_run
17//! use rskit_git::{Differ, Repository, open};
18//!
19//! let repo = open("/path/to/repo").unwrap();
20//! let dirty = repo.is_dirty().unwrap();
21//! let _status = repo.status().unwrap();
22//! assert!(!repo.root().as_os_str().is_empty() || !dirty);
23//! ```
24
25#![warn(missing_docs)]
26
27pub mod auth;
28pub mod cli;
29pub mod core;
30pub mod embedded;
31pub mod error;
32pub mod manage;
33pub mod options;
34pub mod paths;
35pub mod read;
36pub mod repo;
37#[cfg(test)]
38mod tests;
39#[cfg(feature = "testutil")]
40pub mod testutil;
41pub mod types;
42pub mod write;
43
44pub use core::{Executor, Repository};
45pub use error::GitError;
46pub use manage::{ConfigReader, Maintainer, RefManager, RemoteManager};
47pub use options::*;
48pub use paths::{join_repo_path, repo_relative_path};
49pub use read::{Blamer, Differ, IgnoreReader, IndexReader, Inspector, LogReader, TreeReader};
50pub use repo::{Repo, clone, discover, init, init_bare, open};
51pub use rskit_errors::{AppError, AppResult};
52pub use types::*;
53pub use write::{
54    CheckoutManager, CherryPicker, Committer, IndexManager, Merger, Rebaser, Resetter, Stasher,
55};