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(crate) mod github_cli;
26pub mod issue;
27pub mod lfs;
28pub mod pr;
29pub mod status;
30pub mod workspace;
31
32// Re-export commonly used items for convenience within the crate.
33pub(crate) use branch::current_branch;
34pub use clean::{
35    RALPH_RUN_CLEAN_ALLOWED_PATHS, repo_dirty_only_allowed_paths, require_clean_repo_ignoring_paths,
36};
37pub use commit::{
38    abort_rebase, add_paths_force, commit_all, fetch_branch, is_ahead_of_upstream,
39    is_behind_upstream, list_conflict_files, push_current_branch, push_head_to_branch,
40    push_upstream, push_upstream_allow_create, push_upstream_with_rebase, rebase_onto,
41    restore_tracked_paths_to_head, revert_uncommitted, upstream_ref,
42};
43pub use error::GitError;
44pub(crate) use issue::{
45    GITHUB_ISSUE_SYNC_HASH_KEY, compute_issue_sync_hash, create_issue, edit_issue,
46    normalize_issue_metadata_list, parse_issue_number,
47};
48pub use lfs::{check_lfs_health, filter_modified_lfs_files, has_lfs, list_lfs_files};
49// PR-related functions kept for potential non-parallel use, but unused in direct-push mode
50#[allow(unused_imports)]
51pub(crate) use pr::{
52    MergeState, PrInfo, PrLifecycle, check_gh_available, create_pr, merge_pr, pr_lifecycle_status,
53    pr_merge_status,
54};
55pub use status::{
56    ensure_paths_unchanged, ignored_paths, is_path_ignored, snapshot_paths, status_paths,
57    status_porcelain,
58};
59// NEW: workspace-based isolation (clone workspaces).
60pub(crate) use workspace::{
61    WorkspaceSpec, create_workspace_at, origin_urls, remove_workspace, workspace_root,
62};