Skip to main content

Module git_lock

Module git_lock 

Source
Expand description

Git lock utilities for detecting and cleaning stale locks

Functionsยง

clean_stale_index_lock
Detect and remove stale Git index lock if safe to do so Returns true if a stale lock was removed
is_lock_error
Check if an error is a Git lock error
retry_on_lock
Retry an operation that returns CascadeError on index lock contention. Uses exponential backoff with the same timing as with_lock_retry.
wait_for_index_lock
Wait for the git index lock to be released before starting a destructive operation. Polls the filesystem for the lock file to disappear. IDE locks are transient (milliseconds for a status check), so a short timeout catches the common case. Falls back to stale lock cleanup if the lock persists past the timeout.
with_lock_retry
Execute a git2 operation with exponential-backoff retry on index lock contention. Retries up to 4 times with delays of 50ms, 100ms, 200ms before falling back to stale lock cleanup as a last resort.