Expand description
Creation of the shadow repository of one transaction.
What:
Creates the shadow repository of one published transaction:
an empty bare repository,
its config and alternates,
the linked shared entries,
the conclusion state,
and the ref snapshot.
Why:
The shadow is a separate repository rather than a registered worktree,
so git worktree list never shows it and preparation creates no ref in the real repository.
Its object store receives the objects native git commit writes,
and its alternates name the real object directory,
so a real git prune cannot delete a pending commit
(src/shadow-repository/shadow-repository.ts).
In TS you’d write (pseudocode):
await createShadowRepository({ gitPath, cwd, capture, transactionId, transactionDirectory });Functions§
- create_
shadow_ repository - What: Creates the shadow repository of one published transaction. Why: Every step runs before any native Git command reads the shadow, so the first read already sees the real config, objects, links and refs.
- create_
shadow_ repository_ at - What: Creates a shadow repository at a given path, whose parent directory exists. Why: The commit service builds the commits Git must build (an editor, a signature) in a scratch repository inside its own scratch directory, away from the registry directory that recovery scans, so no other process mistakes it for a dead transaction’s shadow.
- create_
shadow_ repository_ carrying - What:
create_shadow_repository_at, with the merge, cherry-pick and revert conclusion state of the worktree either copied into the scratch repository or left out of it. Why: A commit of named paths while another session’s merge is unfinished must build as an ordinary commit of those paths onHEAD(real Git refuses it as a partial commit during a merge); a scratch repository that holds noMERGE_HEADbuilds exactly that, and the landing then leaves the worktree’s own conclusion state alone because the scratch repository never held it. - ensure_
private_ directory - What:
Create a private directory unless another process made it first.
Why:
Concurrent commits of one repository race to create the shared
cli-git/shadowparents; whoever loses has nothing left to do. A path that exists as anything but a directory is still a failure.