git_same/git/mod.rs
1//! Git operations module.
2//!
3//! This module provides abstractions and implementations for git operations.
4//!
5//! # Architecture
6//!
7//! The module is built around the [`GitOperations`] trait, which abstracts
8//! git commands like clone, fetch, pull, and status. This allows for:
9//!
10//! - Real implementations using shell commands ([`ShellGit`])
11//! - Mock implementations for testing
12//!
13//! # Example
14//!
15//! ```no_run
16//! use git_same::git::{ShellGit, GitOperations, CloneOptions};
17//! use std::path::Path;
18//!
19//! let git = ShellGit::new();
20//!
21//! // Clone a repository
22//! let options = CloneOptions::new().with_depth(1);
23//! git.clone_repo(
24//! "git@github.com:user/repo.git",
25//! Path::new("/tmp/repo"),
26//! &options
27//! ).expect("Clone failed");
28//!
29//! // Check status
30//! let status = git.status(Path::new("/tmp/repo")).expect("Status failed");
31//! if status.is_clean_and_synced() {
32//! println!("Repository is clean and in sync");
33//! }
34//! ```
35
36pub mod shell;
37pub mod traits;
38
39pub use shell::ShellGit;
40pub use traits::{CloneOptions, FetchResult, GitOperations, PullResult, RepoStatus};
41
42#[cfg(test)]
43pub use traits::mock::{MockConfig, MockGit};
44
45#[cfg(test)]
46#[path = "mod_tests.rs"]
47mod tests;