Skip to main content

hooks_pre_push

Function hooks_pre_push 

Source
pub fn hooks_pre_push(
    repo: &Repository,
    other_paths: Option<&[&str]>,
    remote: Option<&str>,
    url: &str,
    updates: &[PrePushRef],
) -> Result<HookResult, HooksError>
Expand description

this hook is documented here https://git-scm.com/docs/githooks#_pre_push

According to git documentation, pre-push hook receives:

  • remote name as first argument (or URL if remote is not named)
  • remote URL as second argument
  • information about refs being pushed via stdin in format: <local-ref> SP <local-object-name> SP <remote-ref> SP <remote-object-name> LF

If remote is None or empty, the url is used for both arguments as per Git spec.

Note: The hook is called even when updates is empty (matching Git’s behavior). This can occur when pushing tags that already exist on the remote.