Skip to main content

Module landing_objects

Module landing_objects 

Source
Expand description

Migration of a prepared commit’s shadow objects into a kept pack of the real store. What: Migration of a prepared commit’s shadow-only objects into the real store as one pack, optionally kept by a .keep file naming the transaction. Why: The real target may name the commit only after the compare-and-swap, so its objects must be in the real store first, and the keep stops prune or repack from removing them mid-landing (src/policy-engine/commit-landing-objects.ts).

Durability of the migrated pack: The index-pack child runs with -c core.fsync=-pack,-pack-metadata, which removes the pack and its index files (and the reverse index) from the components Git flushes, so the child makes no fsync call (measured: three per commit by default, none with the override, doc/handover/wrapper-sync-attribution.md, item 4). The override applies to this one child only and wins over a core.fsync the user configured, because it comes after the invocation’s own -c options on the child’s command line. After a power loss on a filesystem that does not order data before the later landing-<n>.json flush, the target ref could name a commit whose pack is missing, and recovery does not notice that. Direct Git carries the same exposure for its loose objects under its default core.fsync. The repository owner accepted this risk (“Real gain real risk. We’re high rollers.”).

In TS you’d write (pseudocode):

await migrateShadowObjects({ gitPath, cwd, shadowPath, newOid, oldBase, keepMessage });

Constants§

INDEX_PACK_FSYNC_OVERRIDE
What: The core.fsync setting of the migration’s index-pack child: Git’s default components minus the pack and its metadata files. Why: The child then makes no fsync call (three by default); the repository owner accepted the durability risk, see the module documentation. It overrides the user’s own core.fsync for that child alone.

Functions§

migrate_shadow_objects
What: Packs the commit’s objects that the shadow holds and the real store lacks, and indexes the pack into the real store. Why: pack-objects --local leaves out objects reached through the shadow’s alternates, so the pack carries only what the landing introduces.