MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / stdin_dispatcher_script_ext

Function stdin_dispatcher_script_ext

atomic-cli/src/commands/git/hooks.rs:336–354  ·  view source on GitHub ↗

Variant with exit-code control: advisory dispatchers end with `|| true` (RFC §11.1: hooks never block), while the CB-12B `pre-push` dispatcher propagates a local refusal's exit status — the hook may fail THIS push locally, which stays advisory to the guarantee (the server gate is what protects; `--no-verify`, removed hooks, and other clients bypass it).

(
    binary: &Path,
    subcommand: &str,
    forward_state_arg: bool,
    propagate_exit: bool,
)

Source from the content-addressed store, hash-verified

334/// locally, which stays advisory to the guarantee (the server gate is what
335/// protects; `--no-verify`, removed hooks, and other clients bypass it).
336fn stdin_dispatcher_script_ext(
337 binary: &Path,
338 subcommand: &str,
339 forward_state_arg: bool,
340 propagate_exit: bool,
341) -> io::Result<String> {
342 let binary = shell_quote(binary)?;
343 let state_arg = if forward_state_arg { " \"$1\"" } else { "" };
344 let failure = if propagate_exit {
345 " || exit $?"
346 } else {
347 " || true"
348 };
349 Ok(format!(
350 "#!/bin/sh\n{DISPATCHER_MARKER}\n\
351{binary} git shim {subcommand}{state_arg}{failure}\n\
352exit 0\n"
353 ))
354}
355
356fn integration_command(binary: &Path) -> io::Result<String> {
357 Ok(format!(

Calls 1

shell_quoteFunction · 0.70