detect_concurrent_git_operations

Function detect_concurrent_git_operations 

Source
pub fn detect_concurrent_git_operations() -> Result<Option<ConcurrentOperation>>
Expand description

Detect concurrent Git operations that would block a rebase.

This function performs a comprehensive check for any in-progress Git operations that would prevent a rebase from starting. It checks for:

  • Rebase in progress (.git/rebase-apply or .git/rebase-merge)
  • Merge in progress (.git/MERGE_HEAD)
  • Cherry-pick in progress (.git/CHERRY_PICK_HEAD)
  • Revert in progress (.git/REVERT_HEAD)
  • Bisect in progress (.git/BISECT_*)
  • Lock files held by other processes

§Returns

Returns Ok(None) if no concurrent operations are detected, or Ok(Some(operation)) with the type of operation detected. Returns an error if unable to check the repository state.

§Example

use ralph_workflow::git_helpers::rebase::detect_concurrent_git_operations;

match detect_concurrent_git_operations() {
    Ok(None) => println!("No concurrent operations detected"),
    Ok(Some(op)) => println!("Concurrent operation detected: {}", op.description()),
    Err(e) => eprintln!("Error checking: {e}"),
}