Skip to main content

Module startup_gate

Module startup_gate 

Source
Expand description

The startup step of a command: isolated merges whose process died, and what an earlier release left behind. What: The startup step of a wrapped, read-only or direct command: settle an isolated merge whose process died, stop on a commit journal of the previous executable’s format, and mention commit records an earlier release left behind. Why: A commit is landed by the resident service, which recovers its own journal, so no commit transaction exists to recover. What stays is state other code still writes (the intent record of an isolated merge) and state an earlier release wrote (the single-journal directory and the registry of commit transactions): the first is settled before anything reads the checkout, the others are named to the person, because nothing here reads them and an interrupted commit of that release is for the person to look at. An empty registry costs one directory read and no Git process.

In TS you’d write (pseudocode):

await settleInterruptedMerges({ identity }); // throws the stop

Enums§

Gate
What: How a command may go on after the startup step. Why: Callers continue or stop from this.

Constants§

LEGACY_JOURNAL_DIRECTORY_NAME
The directory the previous executable kept one commit journal in, inside the worktree’s Git directory.
REGISTRY_DIRECTORY_NAME
The directory an earlier release kept its commit transactions in, inside the worktree’s Git directory.

Functions§

legacy_notice
What: The message for a commit journal of the previous executable’s format. Why: The owner chose to stop with instructions instead of porting that recovery (doc/planning/cli-git-rust-open-decisions.md, “Legacy single-journal directory”).
recover_for_command
What: The startup step for the invocation’s worktree, and how the command may go on. Why: Shared by wrapped commands, read-only commands and direct commands. A recovery failure stops the command with exit 2, as the incumbent’s content-unavailable engine failure does; the note about an earlier release’s records goes to standard error and does not stop it.
registry_note
What: The note about commit records an earlier release left in a registry directory, or nothing when it holds no transaction. Why: A transaction directory there is a commit that release did not finish. This release does not read it or use the directory for anything, so the person is told where it is, how to see whether the commit was made, and the exact command that removes the directory; lock directories and staging names carry nothing to look at.
shell_word
What: The path as one shell word that a copied command line reads back as exactly that path. Why: The note below gives a command to paste, and a Git directory can sit under a name with spaces, quotes or bytes that are not UTF-8; a word cut by one of them would remove a different path. Text goes in single quotes, where only the quote itself needs the '\'' spelling; bytes that are not UTF-8 go in the $'...' form that bash, zsh and ksh read, with octal escapes for every byte outside plain printable ASCII.