Skip to main content

Module event_hints

Module event_hints 

Source
Expand description

The intent-guessing hint that follows a finding, an engine failure or a notice. What: The hint that follows a finding, an engine failure or a warn-unsafe notice: a guess at what the person was trying to do, and the concrete next step. Why: A block that only states a rule leaves the next move to guesswork. Every block and every divergence from real Git’s behavior names the likely intent and a way forward, so a rejected command is a step toward the goal. Messages built with their own hint (the discard, branch, add, root and commit-only rejections) are listed as self-hinted, and a guard test fails when a code has neither.

In TS you’d write (pseudocode):

const hint = hints.get(`${policy}/${code}`); if (hint) event.hint = hint;

Constants§

POST_COMMIT_BLOCKED_HINT
The hint that follows a post-commit gate block.
REPLAY_HEADERS_DROPPED_HINT
The hint that follows a replay that dropped signature headers.
SELF_HINTED
The policy codes whose messages already carry their own intent guess and next step.
WARN_UNSAFE_HINT
What: The hint for a warn-unsafe notice. Why: The person who set a policy to warn wanted commits to keep flowing; the notice says what that costs and what to choose instead.

Functions§

engine_failure_hint
What: The hint for an engine failure, by the code’s wire spelling. Why: An engine failure stops the command before Git runs; the person needs to know whether to retry, fix a file, or report a defect.
finding_hint
What: The hint for a policy finding, or none when the message carries its own. &'static str is text compiled into the program. Why: A finding’s wording is the rule; the hint is the guess about the goal and the way to reach it.
push_hint_field
What: Append the hint field to a JSON event line when a hint exists. &mut String lends the line for appending. Why: The message field stays byte-identical to the retired wrapper’s; the hint is an additive field that readers of the line see without any change to the message.