Skip to main content

Module rule_commit_sequencer

Module rule_commit_sequencer 

Source
Expand description

Pure core of the merge, cherry-pick and revert conclusion check. What: The pure core of the “is a merge, cherry-pick or revert awaiting its commit” check. Why: The caller runs real Git and probes the filesystem; this module says which query to run, reads its output exactly, and decides from three presence facts.

In TS you’d write (pseudocode):

// sequencerState({ mergeHead, cherryPickHead, revertHead }): 'in-progress' | 'none'

Structs§

SequencerFacts
What: Existence of each head file, as the caller observed it. bool is true or false. Why: These three facts are everything the decision needs from the repository.
SequencerOutputError
What: Why the path query’s output could not be read. Why: Output that is not exactly three paths in one directory is reported, never guessed.

Enums§

SequencerState
What: Whether an operation is awaiting its concluding commit. Why: While one is, Git forbids partial commits, so a pathless git commit is the documented conclusion and the commit-only transform lets it through.

Constants§

SEQUENCER_HEAD_FILES
Git-directory files whose presence marks an operation awaiting its concluding commit.

Functions§

sequencer_head_paths
What: Read the query output as three paths without splitting on newlines. Result<Vec<Vec<u8>>, _> is “three byte paths, or a refusal”. Why: A Git directory path may contain a newline. The three files share one directory, so its length follows from the output length and the result is checked byte for byte.
sequencer_query_arguments
What: Build the real-Git argument list: the caller’s global options, then one --git-path per head file. Vec<OsString> is the owned result. Why: --git-path resolves linked worktrees and GIT_DIR, which a lexical join cannot.
sequencer_state
What: Decide from the three presence facts. Why: Any one head file means Git is waiting for the concluding commit.
sequencer_state_when_query_fails
What: The state to use when the path query itself failed. Why: The incumbent falls back to normal enforcement and lets real Git report its error.