Git::Hooks::CheckReference - Git::Hooks plugin for checking references
version 2.8.0
As a Git::Hooks plugin you don't use this Perl module directly. Instead, you may configure it in a Git configuration file like this:
Git::Hooks
[githooks] plugin = CheckReference admin = joe molly [githooks "checkreference"] deny = ^refs/heads/ allow = ^refs/heads/(?:feature|release|hotfix)/ require-annotated-tags = true
The first section enables the plugin and defines the users joe and molly as administrators, effectivelly exempting them from any restrictions the plugin may impose.
joe
molly
The second instance enables some of the options specific to this plugin.
some
The deny and allow options conspire to only allow the creation of branches which names begin with feature/, release/, and hotfix/.
deny
allow
feature/
release/
hotfix/
The require-annotated-tags option rejects pushes with lightweight tags in them.
require-annotated-tags
This Git::Hooks plugin hooks itself to the hooks below to check if the names of references added to or renamed in the repository meet specified constraints. If they don't, the commit/push is aborted.
update
pre-receive
ref-update
To enable it you should add it to the githooks.plugin configuration option:
git config --add githooks.plugin CheckReference
CheckReference - Git::Hooks plugin for checking references
The plugin is configured by the following git options.
It can be disabled for specific references via the githooks.ref and githooks.noref options about which you can read in the Git::Hooks documentation.
githooks.ref
githooks.noref
This directive denies references with names matching REGEXP.
This directive allows references with names matching REGEXP. Since by default all names are allowed this directive is useful only to prevent a githooks.checkreference.deny directive to deny the same name.
The checks are evaluated so that a reference is denied only if it's name matches any deny directive and none of the allow directives. So, for instance, you would apply it like this to allow only the creation of branches with names prefixed by feature/, release/, and hotfix/, denying all others.
[githooks "checkreference"] deny = ^refs/heads/ allow = ^refs/heads/(?:feature|release|hotfix)/
Note that the order of the directives is irrelevant.
By default one can push lightweight or annotated tags but if you want to require that only annotated tags be pushed to the repository you can set this option to true.
Gustavo L. de M. Chaves <gnustavo@cpan.org>
This software is copyright (c) 2018 by CPqD <www.cpqd.com.br>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Git::Hooks, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Git::Hooks
CPAN shell
perl -MCPAN -e shell install Git::Hooks
For more information on module installation, please visit the detailed CPAN module installation guide.