ralph_workflow/git_helpers/
mod.rs1#![deny(unsafe_code)]
18
19use std::io;
20
21pub(crate) fn git2_to_io_error(err: &git2::Error) -> io::Error {
23 io::Error::other(err.to_string())
24}
25
26pub mod branch;
27mod hooks;
28pub mod identity;
29mod rebase;
30
31#[cfg(any(test, feature = "test-utils"))]
32pub mod rebase_checkpoint;
33
34#[cfg(any(test, feature = "test-utils"))]
35pub mod rebase_state_machine;
36
37mod repo;
38mod review_baseline;
39mod start_commit;
40mod wrapper;
41
42#[cfg(any(test, feature = "test-utils"))]
43pub use branch::get_default_branch_at;
44pub use branch::{get_default_branch, is_main_or_master_branch};
45pub use hooks::uninstall_hooks;
46#[cfg(any(test, feature = "test-utils"))]
47pub use hooks::{file_contains_marker_with_workspace, verify_hook_integrity_with_workspace};
48pub use rebase::{
49 abort_rebase, continue_rebase, get_conflict_markers_for_file, get_conflicted_files,
50 rebase_in_progress, rebase_onto, RebaseResult,
51};
52
53#[cfg(any(test, feature = "test-utils"))]
55pub use rebase::{CleanupResult, ConcurrentOperation};
56
57#[cfg(any(test, feature = "test-utils"))]
58pub use rebase::{
59 attempt_automatic_recovery, cleanup_stale_rebase_state, detect_concurrent_git_operations,
60 is_dirty_tree_cli, rebase_in_progress_cli, validate_rebase_preconditions,
61 verify_rebase_completed,
62};
63
64pub use rebase::RebaseErrorKind;
65
66#[cfg(any(test, feature = "test-utils"))]
67pub use rebase_checkpoint::RebasePhase;
68
69#[cfg(any(test, feature = "test-utils"))]
70pub use rebase_state_machine::{RebaseLock, RebaseStateMachine};
71pub use repo::{
72 get_git_diff_for_review_with_workspace, get_git_diff_from_start,
73 get_git_diff_from_start_with_workspace, get_repo_root, git_add_all, git_commit, git_diff,
74 git_diff_from, git_snapshot, require_git_repo, CommitResultFallback, DiffReviewContent,
75 DiffTruncationLevel,
76};
77#[cfg(any(test, feature = "test-utils"))]
78pub use review_baseline::load_review_baseline_with_workspace;
79pub use review_baseline::update_review_baseline_with_workspace;
80pub use review_baseline::{
81 get_baseline_summary, get_review_baseline_info, load_review_baseline, update_review_baseline,
82 ReviewBaseline,
83};
84#[cfg(any(test, feature = "test-utils"))]
85pub use start_commit::load_start_point_with_workspace;
86pub use start_commit::{
87 get_current_head_oid, get_start_commit_summary, load_start_point, reset_start_commit,
88 save_start_commit, save_start_commit_with_workspace, StartPoint,
89};
90pub use wrapper::{
91 cleanup_agent_phase_silent, cleanup_orphaned_marker, disable_git_wrapper, end_agent_phase,
92 start_agent_phase, GitHelpers,
93};
94
95#[cfg(any(test, feature = "test-utils"))]
97pub use wrapper::{
98 cleanup_orphaned_marker_with_workspace, create_marker_with_workspace,
99 marker_exists_with_workspace, remove_marker_with_workspace,
100};
101
102#[cfg(any(test, feature = "test-utils"))]
104pub use rebase_checkpoint::RebaseCheckpoint;
105
106#[cfg(any(test, feature = "test-utils"))]
107pub use rebase_state_machine::RecoveryAction;
108
109#[cfg(test)]
110mod tests;