-
Notifications
You must be signed in to change notification settings - Fork 17
Home
A Perl framework for implementing Git (and Gerrit) hooks.
Git hooks are programs you install in Git repositories in order to augment Git's functionality.
The Git::Hooks Perl module is a framework that makes it easier to implement and use Git hooks. It comes with a set of plugins already implementing useful functionality for you to make sure your commits comply with your project policies. As a Git user or a Git server administrator you probably don't need to implement any hooks for most of your needs, just to enable and configure some of the existing plugins.
Git::Hooks is installed like any other Perl module. It's easier to use a CPAN client, such as cpanm
or cpan
, so that dependencies are installed automatically:
$ cpanm Git::Hooks
$ cpan Git::Hooks
You can even use it directly from a clone of its Git repository. All you have to do is to tell Perl where to find it by using this in your scripts:
use lib '/path/to/clone/of/git-hooks/lib';
use Git::Hooks;
The main module documents its usage in detail. Each plugin is implemented as a separate module under the Git::Hooks::
namespace. The Git::Hooks distribution comes with a set of plugins and you can find more on CPAN. The native plugins provided by the distrubution are these:
- CheckAcls - branch/tag access control
- CheckCommit - enforce commit policies
- CheckFile - check file names and contents
- CheckJira - integrate with JIRA, requiring that issues are cited on commits and imposing restrictions on their state
- CheckLog - enforce log message policies
- CheckReference - check reference names
- CheckRewrite - protect against unsafe rewrites
- CheckWhitespace - detect whitespace errors
- GerritChangeId - insert Gerrit's Change-Ids into commit messages
For a gentler introduction you can try ours tutorials. They have instructions for Git users, Git administrators, and Gerrit administrators.
In order to ask questions or to report problems, please, file an issue at GitHub.
Git::Hooks is copyright (c) 2008-2017 of CPqD.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. About the only thing you can't do is pretend that you wrote code that you didn't.
Gustavo Chaves <[email protected]>