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.fsyncsetting of the migration’sindex-packchild: Git’s default components minus the pack and its metadata files. Why: The child then makes nofsynccall (three by default); the repository owner accepted the durability risk, see the module documentation. It overrides the user’s owncore.fsyncfor 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 --localleaves out objects reached through the shadow’s alternates, so the pack carries only what the landing introduces.