Expand description
The shadow repository links to the real shared entries.
What:
Links every non-private entry of the real common Git directory into a shadow repository,
and copies the per-worktree entries (config.worktree, a linked worktree’s sparse checkout).
Why:
Shared entries such as hooks, info, rr-cache, lfs and modules must be the real ones,
so hooks and native Git see them;
transaction-private entries (refs, index, objects, conclusion state, lock files) stay the shadow’s own
(src/shadow-repository/shadow-links.ts).
On Windows the incumbent uses junctions and copies;
this port uses directory symbolic links and copies, because the standard library has no junction API.
In TS you’d write (pseudocode):
await linkShadowEntries({ shadowPath, commonDir, gitDir });Constants§
- PRIVATE_
SHADOW_ ENTRIES - Real common-directory entries the shadow never links: its ref store, index, config, object store, message file, copied conclusion state, and cli-git’s own state, which contains the shadow itself.
Functions§
- is_
private_ shadow_ entry - What: Reports whether an entry must stay private to the shadow. Why: A shadow Git that locks the same name as the real owner would collide with it, so lock files are never linked.
- link_
shadow_ entries - What:
Links the real common directory into the shadow and copies the per-worktree entries.
Why:
A linked worktree’s
info/sparse-checkoutlives outside the common directory, so itsinfodirectory is private and only its shared entries are linked.