Skip to main content

hook_command

Function hook_command 

Source
pub fn hook_command(
    runner: Runner,
    stage: Stage,
    from: &str,
    to: &str,
) -> Vec<String>
Expand description

Build the argv for a hook invocation against the from..to ref range.

pre-commit / prek: <bin> run --hook-stage <stage> --from-ref <from> --to-ref <to>. hk: hk run <stage> --from-ref <from> --to-ref <to> — hk takes the same --from-ref / --to-ref flags as pre-commit, and needs them when running in an ephemeral worktree (otherwise hk tries to resolve refs/remotes/origin/HEAD and errors out).

Lefthook needs a file list, not refs — use lefthook_command instead.