Skip to main content

Module shadow_git

Module shadow_git 

Source
Expand description

Git commands run against a transaction’s shadow repository. What: Git commands run against a transaction’s shadow repository, and its location and removal. Why: The shadow lives at <git-common-dir>/cli-git/shadow/<transaction-id>, derived from the transaction ID so recovery finds it before prepared.json exists. cli-git’s own shadow commands remove every variable that would redirect Git elsewhere and point hooks at an absent directory, so no hook observes private shadow writes (src/shadow-repository/shadow-refs.ts, runShadowGit).

In TS you’d write (pseudocode):

await runShadowGit({ gitPath, shadowPath, args: ['rev-parse', 'HEAD'] });

Constants§

NO_HOOKS_DIRECTORY
Absent shadow directory named as the hooks path of cli-git’s own shadow commands.
REPOSITORY_REDIRECT_VARIABLES
Variables that would redirect a shadow command to another repository, index or store.

Functions§

remove_shadow_repository
What: Remove a shadow repository, treating an absent one as removed. Why: removeShadowRepository: a shadow never outlives its transaction directory.
shadow_repository_path
What: The shadow repository path of a transaction. Why: shadowRepositoryPath: derived from the ID alone.
shadow_request
What: A request running arguments against the shadow: --git-dir=<shadow>, hooks pointed at an absent directory, redirecting variables removed, in cwd. Why: Every cli-git shadow command looks the same; the caller adds input or variables.