Skip to main content

Module shadow_create

Module shadow_create 

Source
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/shadow parents; whoever loses has nothing left to do. A path that exists as anything but a directory is still a failure.