ralph_workflow/git_helpers/
mod.rs

1//! Git Helper Functions
2//!
3//! Provides git hooks management, a git wrapper for blocking commits during the
4//! agent phase, and basic repository utilities.
5//!
6//! # Module Structure
7//!
8//! - [`hooks`] - Git hooks installation and removal
9//! - [`identity`] - Git identity resolution with comprehensive fallback chain
10//! - [`repo`] - Basic git repository operations (add, commit, snapshot)
11//! - [`start_commit`] - Starting commit tracking for incremental diffs
12//! - [`wrapper`] - Agent phase git wrapper for safe concurrent execution
13//! - [`branch`] - Branch detection and default branch resolution
14//! - Rebase operations are provided via the `rebase` module functions
15
16#![deny(unsafe_code)]
17
18pub mod branch;
19mod hooks;
20pub mod identity;
21mod rebase;
22mod repo;
23mod start_commit;
24mod wrapper;
25
26#[cfg(any(test, feature = "test-utils"))]
27pub mod ops;
28
29#[cfg(any(test, feature = "test-utils"))]
30pub mod test_trait;
31
32pub use branch::{get_default_branch, is_main_or_master_branch};
33pub use hooks::uninstall_hooks;
34pub use rebase::{
35    abort_rebase, continue_rebase, get_conflict_markers_for_file, get_conflicted_files,
36    rebase_onto, RebaseResult,
37};
38pub use repo::{
39    get_git_diff_from_start, get_repo_root, git_add_all, git_commit, git_diff, git_snapshot,
40    require_git_repo, validate_and_truncate_diff, CommitResultFallback,
41};
42pub use start_commit::{reset_start_commit, save_start_commit};
43pub use wrapper::{
44    cleanup_agent_phase_silent, cleanup_orphaned_marker, disable_git_wrapper, end_agent_phase,
45    start_agent_phase, GitHelpers,
46};
47
48#[cfg(any(test, feature = "test-utils"))]
49pub use ops::{CommitResult, GitOps, RealGit};
50
51#[cfg(any(test, feature = "test-utils"))]
52pub use ops::RebaseResult as OpsRebaseResult;
53
54#[cfg(any(test, feature = "test-utils"))]
55pub use test_trait::MockGit;
56
57#[cfg(test)]
58mod tests;