Expand description
Git hook execution helpers.
Structs§
- Commit
Hook Env - Environment for commit-style hooks (
GIT_INDEX_FILE,GIT_EDITOR,GIT_PREFIX, and extra pairs). - Hook
Output - Bytes the hooks of one event wrote while
HookStdio::Capturewas in effect. - PrePush
Ref - One ref update a push is about to make, as reported to the
pre-pushhook. - RefHook
Context - Cached hook execution context for ref-store transactions (no full
Repositoryhandle). - RunHook
Options - Options for
run_hook_opts.
Enums§
- Hook
Error - Hook subprocess failure (non-zero exit or spawn error).
- Hook
Name - Well-known lifecycle hooks that porcelain operations run and report in their outcomes
(for example
crate::porcelain::commit::CommitOutcome::hooks_run). - Hook
Result - Result of running the hooks for one event.
- Hook
Stdio - Where hook subprocesses send their stdout and stderr.
- Post
Operation Hooks - Whether an operation runs the hooks Git runs once it has completed (
post-checkout,post-merge,post-rewrite). - Rewrite
Kind - What kind of rewrite a
post-rewritehook is told about (its first argument).
Functions§
- post_
rewrite_ stdin - Bytes fed to
post-rewriteon 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 (Gitrun_commit_hook). - run_
commit_ hook_ checked - Like
run_commit_hookbut 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_namein Git order; return first non-zero exit or success. - run_
post_ checkout - Run
post-checkout <old> <new> <flag>afterHEADmoved. - run_
post_ merge - Run
post-merge <flag>after a merge or fast-forward updated the work tree; the flag is1for a squash merge and0otherwise. - run_
post_ rewrite - Run
post-rewrite <amend|rebase>withpairs(old new, oldest first) on stdin. - run_
pre_ push_ hook - Run the client-side
pre-pushhook before a push sends anything. - run_
pre_ rebase - Run
pre-rebase <upstream>before a rebase of the checked-out branch rewrites anything.