Skip to main content

Module ref_gate

Module ref_gate 

Source
Expand description

Unified RefUpdateGate for all server-side Git ref mutations.

Enforces per-repository in-process + cross-process serialization (arks-ref-gate.lock), internal refs/arks/* confidentiality, archived repository immutability, branch protection rules (block_delete, block_force_push), PushPolicy, non-bare checkout safety (receive.denyCurrentBranch), Git receive hooks (pre-receive, update, post-receive, post-update), atomic CAS ref mutation, dumb HTTP info/refs refresh, webhooks, and Actions CI.

Spec: .spec/sot/arks-self-host-server.sot.md §38–§43.

Structs§

GatedRefUpdate
Canonical description of one server-side ref create, update, or delete.
RefGateGuard
RAII lock guard serializing ref updates per repository across both threads (via an Arc-backed slot map with zero Box::leak) and OS processes (via sibling lockfile <common_dir>/arks-ref-gate.lock).

Enums§

GateReject
Structured rejection reason returned by RefUpdateGate.

Functions§

acquire_repo_ref_lock
Acquire the per-repository serialization lock (both in-process and cross-process <common_dir>/arks-ref-gate.lock).
apply_gated_ref_update
Apply a single gated ref update acquiring the per-repository RefGateGuard. Drops RefGateGuard BEFORE dispatching synchronous webhooks and CI workflows.
apply_gated_ref_update_locked
Apply a single gated ref update when the caller already holds RefGateGuard for repo.common_dir(). Executes only lock-scoped effects (update_server_info); callers needing external webhooks/CI should invoke [post_receive_external_effects] after dropping guard.
check_non_bare_deny_current_branch
Check non-bare checkout safety per receive.denyCurrentBranch / receive.denyDeleteCurrent.
enforce_branch_rules_and_policy
Enforce internal ref isolation, archived-repo immutability, ForgeStore.branch_rules (block_delete, block_force_push), non-ff rules, and the installed process-wide PushPolicy.
post_receive_side_effects
Shared post-receive side effects combining lock-scoped repository refreshes and external notifications: