Crate git2_hooks

Source
Expand description

git2-rs addon supporting git hooks

we look for hooks in the following locations:

  • whatever config.hooksPath points to
  • .git/hooks/
  • whatever list of paths provided as other_paths (in order)

most basic hook is: hooks_pre_commit. see also other hooks_* functions.

create_hook is useful to create git hooks from code (unittest make heavy usage of it)

Enums§

HookResult
HooksError
crate specific error type
PrepareCommitMsgSource

Constants§

HOOK_COMMIT_MSG
HOOK_POST_COMMIT
HOOK_PREPARE_COMMIT_MSG
HOOK_PRE_COMMIT

Functions§

create_hook
helper method to create git hooks programmatically (heavy used in unittests)
hooks_commit_msg
Git hook: commit_msg
hooks_post_commit
this hook is documented here https://git-scm.com/docs/githooks#_post_commit
hooks_pre_commit
this hook is documented here https://git-scm.com/docs/githooks#_pre_commit
hooks_prepare_commit_msg
this hook is documented here https://git-scm.com/docs/githooks#_prepare_commit_msg