pub fn copy_reachable_objects_excluding(
source: &Repository,
target: &Repository,
roots: impl IntoIterator<Item = ObjectId>,
excluded: &HashSet<ObjectId>,
) -> GitProjectionResult<()>Expand description
Incremental variant of copy_reachable_objects: copy the closure
reachable from roots, skipping every object in excluded.
INVARIANT: every OID in excluded MUST already be present in target — the
walk neither visits nor copies an excluded object (nor anything reachable only
through it), so excluding an object the target is missing would silently drop
it. Callers satisfy this by computing excluded as the reachable closure of
something already in target. Used by checkpoint write-through, which passes
the prior checkout HEAD’s full closure (already entirely in the checkout’s
object DB): the new commit’s tree re-reaches the parent’s unchanged
trees/blobs, so excluding the whole closure — not just the parent commit —
prunes them all, turning per-checkpoint object transfer from O(total history)
into O(objects new since the parent). Output is byte-identical — the same
objects end up in target; the pruned ones were already there.