Skip to main content

Module graph

Module graph 

Source
Expand description

Commit-graph traversal helpers.

This module exposes collect_ancestor_set. Higher-level walks (is_ancestor, find_merge_base) live in super::merge alongside the merge algorithm that consumes them.

Bound: at most MAX_ANCESTORS (10_000) commits are visited per call. Beyond that the walk stops silently — callers asking about pathologically deep histories get a partial answer rather than an OOM.

Constants§

MAX_ANCESTORS
Hard cap on commits visited per call.
MAX_REACHABLE
Hard cap on the total number of objects reachable_objects will visit per call. Matches the scale of MAX_ANCESTORS but applies to the full object closure (commits + trees + blobs + chunks), so it is intentionally larger. A repo that exceeds this cap has to split pushes — the push-path is the only caller for now.

Functions§

collect_ancestor_set
Collect the set of all ancestor commits of start, including start itself, by DFS over Commit::parents. The walk:
reachable_closure
Collect every object reachable from any of roots — the multi-root generalization of reachable_objects. This is the closure mkit gc (#233) keeps live: seed it with the full retention root set from super::gc::collect_roots and every object NOT in the result is unreachable.
reachable_closure_checked
Like reachable_closure but also reports whether the MAX_REACHABLE cap truncated the walk (true = incomplete). A caller that would delete unreachable objects (gc) MUST treat truncated == true as fatal: beyond the cap the “unreachable” verdict is unsound, so pruning would drop live data.
reachable_objects
Collect every object reachable from commit root — the full closure needed to reconstruct the commit on a fresh store. Walks, in order: