The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Git::MoreHooks::CheckCommitBase - CheckCommit base file

VERSION

version 0.015

SYNOPSIS

Use package via Git::Hooks interface (git config file).

DESCRIPTION

Base for Commit checking hooks.

STATUS

Package Git::MoreHooks is currently being developed so changes in the existing hooks are possible.

USAGE

    use Git::MoreHooks::CheckCommitBase;
    $::ROOT_FUNC = \&my_check_function;

Alternatively:

    use Git::MoreHooks::CheckCommitBase \&my_check_function;

Git::MoreHooks::CheckCommitBase hooks itself to the hooks below:

  • pre-commit

    This hook is invoked during the commit.

  • update

    This hook is invoked multiple times in the remote repository during git push, once per branch being updated.

  • pre-receive

    This hook is invoked once in the remote repository during git push.

  • ref-update

    This hook is invoked when a push request is received by Gerrit Code Review.

  • patchset-created

    This hook is invoked when a push request is received by Gerrit Code Review for a virtual branch (refs/for/*).

  • draft-published

    The draft-published hook is executed when the user publishes a draft change, making it visible to other users.

CONFIGURATION

This plugin is configured by the following git options.

githooks.<check-commit-hook-name>.ref REFSPEC

By default, the message of every commit is checked. If you want to have them checked only for some refs (usually some branch under refs/heads/), you may specify them with one or more instances of this option.

The refs can be specified as a complete ref name (e.g. "refs/heads/master") or by a regular expression starting with a caret (^), which is kept as part of the regexp (e.g. "^refs/heads/(master|fix)").

EXPORTS

This module exports the following routines that can be used directly without using all of Git::Hooks infrastructure.

pre_commit_callback GIT

This is the routine used to implement the pre-commit hook. It needs a Git::More object.

update_callback GIT

This is the routine used to implement the update hook. It needs a Git::More object.

pre_receive_callback GIT, COMMIT

This is the routine used to implement the pre-receive hook. It needs a Git::More object and a commit hash from Git::More::get_commit().

ref_update_callback GIT

This is the routing used to implement the update and the pre-receive hooks. It needs a Git::More object.

patchset_created_callback GIT, HASH

This is the routine used to implement the patchset-created Gerrit hook. It needs a Git::More object and the hash containing the arguments passed to the hook by Gerrit.

draft_published_callback GIT, HASH

This is the routine used to implement the draft-published Gerrit hook. It needs a Git::More object and the hash containing the arguments passed to the hook by Gerrit.

NOTES

Thanks go to Gustavo Leite de Mendonça Chaves for his Git::Hooks package.

SUBROUTINES/METHODS

AUTHOR

'Mikko Koivunalho <mikko.koivunalho@iki.fi>'

COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by Mikko Koivunalho.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.