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
argumentsagainst the shadow:--git-dir=<shadow>, hooks pointed at an absent directory, redirecting variables removed, incwd. Why: Every cli-git shadow command looks the same; the caller adds input or variables.