Skip to main content

sync_tree

Function sync_tree 

Source
pub fn sync_tree(
    store: &mut Store,
    repo: &Repo,
    cache: &ObjectCache,
    extractor: &dyn Extractor,
    rev: &str,
) -> Result<SyncReport, SyncError>
Expand description

Extract a repo’s derived graph at an arbitrary commit/tree rev into store, replacing its contents — the same content-addressed extraction as sync, but for a historical point rather than HEAD. Because extraction is keyed by (path, blob oid, env), every blob unchanged versus another synced point is a cache hit, so resolving an older version only re-does what differs.

This backs version-pin resolution (ADR-0009 step 8): to resolve a spoke’s cross-repo reference against the hub version it deploys (a submodule sha, an image tag → commit), extract the hub at that rev into an ephemeral store and resolve there. It populates the derived layer only (config keys, symbols, calls); authored/import layers are not re-applied, since this is a read-only resolution snapshot. No sync-state is recorded (tree carries rev for the report only).

§Errors

Returns SyncError on git access, extraction caching, or store failure.