Skip to main content

Module shadow_links

Module shadow_links 

Source
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-checkout lives outside the common directory, so its info directory is private and only its shared entries are linked.