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

Changes for version 2.0.0 - 2017-06-15 (TRIAL RELEASE)

  • This is a major new version of Git::Hooks and there is a few incompatible changes mentioned below. Most of them affect only hook and plugin developers, but not users. As a user you'll be affected only if you use the CheckStructure plugin, which was removed from the distribution. If you depend on it, you may reimplement its checks using the CheckFile and the CheckReference plugins.
  • Incompatible changes
    • Replace the Git module by the Git::Repository module as the underlying git wrapper. This means that hooks now receive a Git::Repository object as their first argument instead of a Git::More object, which may affect the code of hooks and plugins.
    • The Git::More module was transformed into the Git::Repository::Plugin::GitHooks module to take advantage of Git::Repository's plugin architecture. This means that the Git::Repository object passed to hooks will have the Git::Repository::Plugin::GitHooks plugin enabled, which brings most of the methods previously provided by Git::More.
    • Git::Hooks now only exports the hook directives and the 'run_hook' function. All the other functions previously implemented by it are now provided by Git::Repository::Plugin::GitHooks.
    • Git::Repository::Plugin::GitHooks's methods 'get_commit', 'get_commits', and 'get_affected_ref_commits' now return Git::Repository::Log objects instead of naked hashes to represent commits.
    • The CheckStructure plugin was removed from the distribution. Its funcionality is provided by the CheckFile and the new CheckReference plugins.
  • New features
    • New options for the 'githooks' section: 'error-header' and 'error-footer'. These allow for the injection of a header and/or a footer along with Git::Hooks's error messages.
    • CheckReference: new plugin for checking branch names.
    • CheckJira: new options: 'jql', 'ref-jql'. These allow one to use JIRA's JQL expressions to impose restrictions on the JIRA issues cited on commit messages.
    • CheckJira: new option 'skip-merges' to avoid checking merge commits.
    • CheckCommit: new configuration option 'merger' to define the users allowed to push merge commits.
    • CheckCommit: new configuration option 'push-limit' to specify the maximum number of commits that may be pushed at once over a branch.
    • CheckFile: New configuration option 'basename.sizelimit' to specify size limits per file name.
    • The Git::Hooks documentation now contains a section for plugin developers.
  • Deprecations
    • Remove the deprecated configuration options 'githooks.gerrit.review-label', 'githooks.gerrit.vote-ok', and 'githooks.gerrit.vote-nok'.
    • CheckJira: deprecates the configuration options 'project', 'status', and 'issuetype'. They're better implemented by the new 'jql' option.

Documentation

Gentle tutorial for Git::Hooks users and Git administrators

Modules

Framework for implementing Git (and Gerrit) hooks
Git::Hooks plugin for branch/tag access control
Git::Hooks plugin to enforce commit policies
Git::Hooks plugin for checking files
Git::Hooks plugin which requires citation of JIRA issues in commit messages
Git::Hooks plugin to enforce commit log policies
Git::Hooks plugin for checking references
Git::Hooks plugin for checking against unsafe rewrites
Git::Hooks plugin for checking whitespace errors
Git::Hooks plugin to insert a Change-Id in a commit message
Git::Hooks testing utilities
A Git commit message
A Git::Repository plugin with some goodies for hook developers