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.
- 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.