Skip to main content

ralph/git/
mod.rs

1//! Git operations module.
2//!
3//! This module provides a comprehensive set of git operations for Ralph,
4//! organized into focused submodules:
5//!
6//! - `error`: Error types and classification
7//! - `status`: Status parsing and path tracking
8//! - `lfs`: Git LFS detection and validation
9//! - `commit`: Commit and push operations
10//! - `clean`: Repository cleanliness validation
11//!
12//! # Invariants
13//! - All operations use `-c core.fsmonitor=false` to avoid fsmonitor issues
14//! - Error types are Send + Sync for anyhow compatibility
15//! - LFS operations gracefully handle repositories without LFS
16//!
17//! # What this does NOT handle
18//! - General file system operations (use std::fs or anyhow)
19//! - Non-git version control systems
20
21pub mod branch;
22pub mod clean;
23pub mod commit;
24pub mod error;
25pub mod issue;
26pub mod lfs;
27pub mod pr;
28pub mod status;
29pub mod workspace;
30
31// Re-export commonly used items for convenience within the crate.
32pub(crate) use branch::current_branch;
33pub use clean::{
34    RALPH_RUN_CLEAN_ALLOWED_PATHS, repo_dirty_only_allowed_paths, require_clean_repo_ignoring_paths,
35};
36pub use commit::{
37    abort_rebase, add_paths_force, commit_all, fetch_branch, is_ahead_of_upstream,
38    is_behind_upstream, list_conflict_files, push_current_branch, push_head_to_branch,
39    push_upstream, push_upstream_allow_create, push_upstream_with_rebase, rebase_onto,
40    restore_tracked_paths_to_head, revert_uncommitted, upstream_ref,
41};
42pub use error::GitError;
43pub(crate) use issue::{
44    GITHUB_ISSUE_SYNC_HASH_KEY, compute_issue_sync_hash, create_issue, edit_issue,
45    normalize_issue_metadata_list, parse_issue_number,
46};
47pub use lfs::{check_lfs_health, filter_modified_lfs_files, has_lfs, list_lfs_files};
48// PR-related functions kept for potential non-parallel use, but unused in direct-push mode
49#[allow(unused_imports)]
50pub(crate) use pr::{
51    MergeState, PrInfo, PrLifecycle, check_gh_available, create_pr, merge_pr, pr_lifecycle_status,
52    pr_merge_status,
53};
54pub use status::{
55    ensure_paths_unchanged, ignored_paths, is_path_ignored, snapshot_paths, status_paths,
56    status_porcelain,
57};
58// NEW: workspace-based isolation (clone workspaces).
59pub(crate) use workspace::{
60    WorkspaceSpec, create_workspace_at, origin_urls, remove_workspace, workspace_root,
61};