Skip to main content

Module hooks

Module hooks 

Source
Expand description

Git hook execution helpers.

Structs§

CommitHookEnv
Environment for commit-style hooks (GIT_INDEX_FILE, GIT_EDITOR, GIT_PREFIX, and extra pairs).
HookOutput
Bytes the hooks of one event wrote while HookStdio::Capture was in effect.
PrePushRef
One ref update a push is about to make, as reported to the pre-push hook.
RefHookContext
Cached hook execution context for ref-store transactions (no full Repository handle).
RunHookOptions
Options for run_hook_opts.

Enums§

HookError
Hook subprocess failure (non-zero exit or spawn error).
HookName
Well-known lifecycle hooks that porcelain operations run and report in their outcomes (for example crate::porcelain::commit::CommitOutcome::hooks_run).
HookResult
Result of running the hooks for one event.
HookStdio
Where hook subprocesses send their stdout and stderr.
PostOperationHooks
Whether an operation runs the hooks Git runs once it has completed (post-checkout, post-merge, post-rewrite).
RewriteKind
What kind of rewrite a post-rewrite hook is told about (its first argument).

Functions§

post_rewrite_stdin
Bytes fed to post-rewrite on stdin: one <old> <new> line per rewritten commit.
resolve_hooks_dir
Resolve the hooks directory from config or fall back to $GIT_DIR/hooks.
run_commit_hook
Run commit-style hooks with GIT_INDEX_FILE, GIT_PREFIX, and related env (Git run_commit_hook).
run_commit_hook_checked
Like run_commit_hook but a hook that exits non-zero is an error.
run_hook
Run a hook by name with the given arguments (Git-compatible multihooks).
run_hook_in_git_dir
Run a server-side hook (pre-receive, update, …) with cwd = GIT_DIR.
run_hook_opts
Run all hooks for hook_name in Git order; return first non-zero exit or success.
run_post_checkout
Run post-checkout <old> <new> <flag> after HEAD moved.
run_post_merge
Run post-merge <flag> after a merge or fast-forward updated the work tree; the flag is 1 for a squash merge and 0 otherwise.
run_post_rewrite
Run post-rewrite <amend|rebase> with pairs (old new, oldest first) on stdin.
run_pre_push_hook
Run the client-side pre-push hook before a push sends anything.
run_pre_rebase
Run pre-rebase <upstream> before a rebase of the checked-out branch rewrites anything.