Skip to main content

Module external_hooks

Module external_hooks 

Source
Expand description

The configured external hooks, read from the snapshot, and the loud report that none runs. What: The external hooks a repository configures (hook.<name>.event with hook.<name>.command), read from the configuration snapshot, and the loud report that none of them runs. Why: The wrapper supports no external hook program at all: every real-Git start of the wrapper switches every hook event off (hooks_off.rs), and the behaviors a hook used to provide are declared natively in cli-git.config.jsonc. A configured hook that silently never ran would look like a broken check, so a commit prints one configuration-warning event naming the keys and the events, decided from the snapshot the commit already holds (no process start), and git cli-git doctor lists the same hooks.

In TS you’d write (pseudocode):

const hooks = configuredHooks(snapshot); if (hooks.length > 0) stderr.write(renderConfigurationWarning(0, code, message, names));

Structs§

ConfiguredHook
What: One configured hook. Why: The report names the hook, its events and whether it has a command, so the author knows which keys to remove.

Constants§

EXTERNAL_HOOKS_UNSUPPORTED_CODE
Code of the configuration warning for configured external hooks.

Functions§

configured_hooks
What: Every configured hook that is not switched off by its own hook.<name>.enabled, in the order the snapshot lists them. Why: The hooks Git would have run: a name with an event or a command, minus the ones the author already disabled.
describe_hook
What: The hook as one phrase: hook.<name> (events: a, b). Why: The report lists each hook by the key prefix the author would unset.
explain_external_hooks
What: The sentence that explains what to do about configured hooks. Why: The explanation is shared by the commit warning and git cli-git doctor, so both say the same ways forward.
external_hooks_warning
What: The warning line for configured external hooks, or nothing when the snapshot defines none. Why: The answer comes from the snapshot alone, so a repository without hooks pays no process start and no file system call.
warn_external_hooks
What: Write the warning, when there is one, to stream. Why: The command’s exit status already carries its result, so a stream that refuses the line is logged and the command goes on.