Skip to main content

Module git_helpers

Module git_helpers 

Source
Expand description

Git Helper Functions

Provides git hooks management, a git wrapper for blocking commits during the agent phase, and basic repository utilities.

Core git operations use libgit2 directly. Agent-phase defense-in-depth may also install a temporary PATH wrapper that intercepts the git CLI when available.

§Module Structure

  • runtime/hooks - Git hooks installation and removal (boundary module)
  • identity - Git identity resolution with comprehensive fallback chain
  • repo - Basic git repository operations (add, commit, snapshot)
  • start_commit - Starting commit tracking for incremental diffs
  • review_baseline - Per-review-cycle baseline tracking
  • runtime/wrapper - Agent phase git wrapper for safe concurrent execution (boundary module)
  • branch - Branch detection and default branch resolution
  • rebase - Rebase operations with fault tolerance

Re-exports§

pub use branch::get_default_branch;
pub use branch::is_main_or_master_branch;
pub use hooks::install_hooks_in_repo;
pub use hooks::reinstall_hooks_if_tampered;
pub use hooks::uninstall_hooks;
pub use hooks::uninstall_hooks_in_repo;
pub use hooks::uninstall_hooks_silent_in_hooks_dir;
pub use hooks::verify_hooks_removed;
pub use hooks::HOOK_MARKER;
pub use hooks::RALPH_HOOK_NAMES;
pub use rebase::abort_rebase;
pub use rebase::continue_rebase;
pub use rebase::get_conflict_markers_for_file;
pub use rebase::get_conflicted_files;
pub use rebase::rebase_in_progress;
pub use rebase::rebase_onto;
pub use rebase::RebaseResult;
pub use rebase::RebaseErrorKind;
pub use wrapper::capture_head_oid;
pub use wrapper::cleanup_agent_phase_protections_silent_at;
pub use wrapper::cleanup_agent_phase_silent;
pub use wrapper::cleanup_agent_phase_silent_at;
pub use wrapper::cleanup_orphaned_marker;
pub use wrapper::cleanup_orphaned_wrapper_at;
pub use wrapper::clear_agent_phase_global_state;
pub use wrapper::detect_unauthorized_commit;
pub use wrapper::disable_git_wrapper;
pub use wrapper::end_agent_phase;
pub use wrapper::end_agent_phase_in_repo;
pub use wrapper::ensure_agent_phase_protections;
pub use wrapper::start_agent_phase;
pub use wrapper::start_agent_phase_in_repo;
pub use wrapper::try_remove_ralph_dir;
pub use wrapper::verify_ralph_dir_removed;
pub use wrapper::verify_wrapper_cleaned;
pub use wrapper::GitHelpers;
pub use wrapper::ProtectionCheckResult;
pub use wrapper::cleanup_orphaned_marker_with_workspace;
pub use wrapper::create_marker_with_workspace;
pub use wrapper::marker_exists_with_workspace;
pub use wrapper::remove_marker_with_workspace;

Modules§

branch
Git branch detection and default branch resolution.
cleanup
config_state
hooks
Git hook installation and management.
hooks_dir
identity
Git identity resolution with fallback chain.
install
lock
marker
path_wrapper
phase
phase_state
Runtime module containing OS-boundary code (std::fs, std::process, std::env, Mutex). This module is exempt from functional Rust dylint rules.
rebase
Git rebase operations using libgit2 with Git CLI fallback.
runtime
Runtime primitives for git_helpers boundary module.
runtime_identity
script
Git wrapper script generation for agent-phase commit protection.
uninstall
verify
worktree
wrapper
Git wrapper for blocking commits during agent phase.

Structs§

DiffReviewContent
The result of diff truncation for review purposes.
ProtectionScope

Enums§

CommitResultFallback
Result of commit operation with fallback.
DiffTruncationLevel
The level of truncation applied to a diff for review.
ReviewBaseline
StartPoint

Functions§

ensure_local_excludes
get_baseline_summary
get_current_head_oid
Get the current HEAD commit OID.
get_current_head_oid_at
Get the current HEAD commit OID for an explicit repository root.
get_git_diff_for_review_with_workspace
Get the diff content that should be shown to reviewers.
get_git_diff_from_start
Get the git diff from the starting commit.
get_git_diff_from_start_with_workspace
Get the git diff from the starting commit (workspace-aware).
get_hooks_dir
Errors
get_repo_root
Get the git repository root.
get_review_baseline_info
get_start_commit_summary
Get a summary of the start commit state for display.
git_add_all
Stage all changes.
git_add_all_in_repo
Stage all changes in the repository discovered from repo_root.
git_add_specific_in_repo
Stage specific files for commit.
git_commit
Create a commit.
git_commit_in_repo
Create a commit in the repository discovered from repo_root.
git_diff
Get the diff of all changes (unstaged and staged).
git_diff_from
Generate a diff from a specific starting commit.
git_diff_in_repo
Get the diff of all changes (unstaged and staged) by discovering from an explicit path.
git_oid_to_git2_oid
git_snapshot
Get a snapshot of the current git status.
git_snapshot_in_repo
Get a snapshot of git status for a specific repository root.
load_review_baseline
load_start_point
Load the starting commit OID from the file.
parse_git_status_paths
Extract repo-relative paths from a porcelain v1-style status snapshot.
require_git_repo
Check if we’re in a git repository.
reset_start_commit
Reset the starting commit to merge-base with the default branch.
resolve_protection_scope
Resolve the active git-protection scope for the current repository context.
resolve_protection_scope_from
save_start_commit
Save the current HEAD commit as the starting commit.
save_start_commit_with_workspace
Save start commit using workspace abstraction.
update_review_baseline
update_review_baseline_with_workspace