Revision history for perl module Git-Hooks. -*- text -*- 0.044 2013-06-27 09:13:28 America/Sao_Paulo [Fixes] - Version 0.043 used the s///r operator, which was implemented on Perl 5.14. This version refactors it to avoid the operator and keep compatibility with Perl 5.10. 0.043 2013-06-26 10:35:02 America/Sao_Paulo [New features] - Support the new pre-push hook, implemented by Git 1.8.2 which is invoked during a "git push" command. - New class Git::More::Message, representing a Git commit message. Generally speaking, a commit message can be any string whatsoever. However, the Git community came up with a few conventions for how to best format a message and this class embraces those conventions making it easier for you to validate and change a commit message structure. With it the Git::Hooks::CheckLog and Git::Hooks::GerritChangeId plugins were much simplified. - New method Git::More::read_commit_msg_file that reads the contents of a file, respecting the i18n.commitencoding config option, and returns its contents stripspaced. - New method Git::More::write_commit_msg_file that writes a string to a file respecting the i18n.commitencoding config option. - New methods Git::More::push_input_data and Git::More::get_input_data to unify the treatment of data read from STDIN by the hooks pre-receive, post-receive, pre-push, and post-rewrite. [Fixes] - The data passed to the post-rewrite hook via STDIN wasn't being processed. 0.042 2013-05-31 15:17:39 America/Sao_Paulo [New features] - CheckJira: Make githooks.checkjira.matchlog option be multi-valued. This allows one to specify more than one place in the commit message where JIRA keys are looked for. - Add a User Tutorial document. [Fixes] - Make tests independent of git's global init.templatedir option. 0.041 2013-05-25 11:46:39 America/Sao_Paulo [New features] - Support Gerrit's ref-update and patchset-created hooks. Gerrit (http://gerrit.googlecode.com/) is a web-based code review system which incorporates a Git server implemented with JGit (http://www.eclipse.org/jgit/), which is a pure Java implementation of Git. Up to version 2.2.0 JGit still doesn't support Git standard hooks. However, Gerrit implements its own special hooks (http://gerrit-documentation.googlecode.com/svn/Documentation/2.6/ config-hooks.html), which are rather different from Git's. - New option: githooks.disable. This option can be used to disable plugins otherwise enabled by the githooks.plugin option. It's useful if you want to enable a plugin globally and only disable it for some repositories. [Fixes] - CheckRewrite: Detect and allow fast-forward "git rebase upstream base". If upstream is a decendant of base, the base-commit is empty. In this situation the rebase will turn out to be a simple fast-forward merge from base on upstream and there is nothing to lose. - Fix plugin disabling detection. Plugins enabled in the configuration using their full module name could not be disabled via the environment variable trick, because the variable must have the full plugin name, but ':' characters are not accepted in environment variable names. - Fix BAIL_OUT message during tests. 0.040 2013-03-15 00:21:24 America/Sao_Paulo The 0.039 release package contained some experimental code unintentionally. This new release simply fix this. The changes recorded below for the 0.039 release are still valid. 0.039 2013-03-14 23:56:15 America/Sao_Paulo [New features] - run_hook doesn't die at the first error anymore. Now it collects errors from all hooks to be able to show them all when it dies at the end. These modification required changes to all plugins to make them invoke an error method instead of simply dying. [Changes] - Git::More::get_current_branch previously returned the branch short-name. Now it returns the branch full name. Moreover, when in dettached mode it returns undef. [Fixes] - The exit code of external pre-receive hooks weren't being dealt with correctly. - The arguments for update and pre-receive hooks weren't being dealt with correctly when new branches were being pushed or branches were being deteled on a push. - Fix Git::More::is_ref_enabled for when in dettached head state. It returns true in this case. [Cleanup] - Fix all L<> POD tags in the documentation. 0.038 2013-02-01 16:25:00 America/Sao_Paulo [Updates] - Remove "beta status" warning from README. [Fixes] - The dzil configuration now correctly detects build-time dependencies. - The testing framework now produces some more intelligent error messages. 0.037 2013-01-29 22:14:25 America/Sao_Paulo [New features] - Makefile.PL now tries to find Git.pm on some usual places if it can't require it using the standard @INC. This allows for installation and testing on systems where Git cannot be required directly. - GerritChangeId wasn't calculating the Change-Id correctly in some cases. [Fixes] - CheckRewrite wasn't showing the names reaching branch names correctly. [Refactorings for a future port to Windows (We're not there yet!)] - The testing framework now uses Git::command to invoke git instead of using directly an open pipe. - Git::More used Git::command_output_pipe in a way that wasn't working on Windows. - External hooks won't be supported on Windows for a while. Hence, some tests are skipped. - The testing framework uses sh-scripts to indirectly invoke the Perl hooks on Windows, because that OS does not follow the shee-bang Unix conventions. - Several other small changes. 0.036 2013-01-19 16:41:16 America/Sao_Paulo [Interface changes] - Internal hooks now shouldn't die directly when they detect a problem. Instead, they should invoke the new Git::More::error method to produce the error message and return a boolean value indicating if they have succeeded. This way they don't need to stop at the first error, but can detect many more and generate more information to the user. In order to support old hooks, run_hooks checks their return values. If they return a boolean, they're treated as modern hooks. If they return undef (and $@ is empty, so that it wasn't an exception) they are considered to have succeeded. [New] - Git::Hooks::run_hooks only dies after having run every internal and external hooks and seeing that not every one of them succeeded. This way the user gets informed of every problem and not just the first one found. - Add method Git::More::error to be used by plugins to produce consistent error and warning messages to the user. - Add method Git::More::clean_cache to delete a cache entry. It may be used by hooks just before returning to Git::Hooks::run_hooks in order to get rid of any value kept in the SECTION's entry. [Fix] - CheckLog did not treat empty commit messages correctly. 0.035 2013-01-18 08:44:20 America/Sao_Paulo [New] - Provide for temporary disabling of plugins by setting to a false value (e.g. '0') an environment variable named after the plugin. This is useful for temporary disabling of pre-commit hooks, for instance. - Add method Git::More::set_authenticated_user This method can be used to set the username of the authenticated user when the default heristics used by the method authenticated_user aren't enough. The name is cached so that subsequent invokations of authenticated_user will return it. [Fix] - CheckRewrite was invoking 'git branch --all' but old versions of git didn't support the long option name. Now it uses '-a' instead. - CheckRewrite error messages showed branch names with two character prefix. [Cleanup] - Make the Change file conform to the Specification for CPAN Changes files (CPAN::Changes::Spec). 0.034 2013-01-16 12:22:37 America/Sao_Paulo [New] - Implement the new Git::Hooks::CheckRewrite plugin to check the safety of rewrites, by detecting when we're amending or rebasing commits that have already been pushed. 0.033 2013-01-12 18:45:07 America/Sao_Paulo [Incompatible changes] - Substitute Git for App::gh::Git as a parent for Git::More. The major motivation for this was to get rid of some heavy dependencies that were carried over by App::gh. This change should be mostly transparent, as App::gh::Git is a copy of Git. Since Git isn't on CPAN we can't depend directly on it. The user must guarantee that it is present on @INC in order to install and use Git::Hooks. The environment variable GITPERLLIB can be used to specify a list of directories (besides the ones already in @INC) where the module will be searched. - Consolidate the methods Git::More::get_config and Git::More::config in a single method Git::More::get_config, which returns ever more specialized configuration depending on how many arguments it gets (zero, one, or two). This change affects most plugins. [Fix] - Make a change in the way we inkoke "git init" during test so that we can use pre-v1.6.5 gits. 0.032 2013-01-06 10:06:48 America/Sao_Paulo [Incompatible change] - Simplify plugin/hook integration. Previously, if a plugin could be hooked to more than one hook, one should configure all the integrations by hand. For instance, the CheckJira plugin can be hooked to the update, the pre-receive, and the commit-msg hooks, and the user had to know which hooks should be enabled. Now it's easier because the plugins can hook themselves to all hooks directly. In this way, for instance, instead of configuring CheckJira specifically for one of those hooks with one of the following configurations: git config --add githooks.commig-msg CheckJira git config --add githooks.pre-receive CheckJira git config --add githooks.update CheckJira One can simply do this: git config --add githooks.plugin CheckJira CheckJira will automatically be enabled for all plugins. Also, the plugins can be referred to by their fully qualified module names (e.g. Git::Hooks::CheckJira) to allow for third party plugins. If the githooks.plugin option is not defined, the configuration processing will try to build it from the old githooks.HOOK configuration options that are not needed anymore, so to preserve compatibility. This is a temporary measure. 0.031 2013-01-05 23:33:50 America/Sao_Paulo [Incompatible changes] - Move plugin config options to a githooks subsection. For example, the CheckLog.spelling option now is called githooks.checklog.spelling. The new scheme avoids unecessary pollution of the configuration namespace. The plugins that existed up to the previous release can still have their options in the previous place, because we dynamically move them. This is a temporary measure to avoid breaking old configuration. It will probably be removed in the future. [Cleanup] - Rename TODO to TODO.pod and update it with new ideas. 0.030 2012-12-29 23:06:08 America/Sao_Paulo [Fix] - Fix two bugs. No new features. 0.029 2012-12-26 23:12:17 America/Sao_Paulo [Fix] - Fix test t/02-check-log.t requirement of Text::SpellChecker. - Recommends Text::SpellChecker instead of requiring it, as it's only needed for the Git::Hooks::CheckLog plugin. [Cleanup] - Update TODO file. 0.028 2012-12-25 22:47:34 America/Sao_Paulo [New] - CheckLog implements spell checking of log messages. [Fix] - Abort building on Windows. We're not ready yet. - Git::More::get_commit_msg now supports pre-1.7.2 Gits. 0.026 2012-12-22 20:23:22 America/Sao_Paulo [New] - Implement a new plugin Git::Hooks::CheckLog to enforce formatting policies for git commit log messages. [Fix] - Fix configuration grokking. - Recommends JIRA::Client instead of requiring it, as it is only needed for the Git::Hooks::CheckJira plugin. 0.025 2012-12-21 08:06:04 America/Sao_Paulo - This version is another big refactoring. It introduces a few incompatible changes as well, for good measure. ;-) [Incompatible Changes Affecting Plugin Users] - The CheckJira.by-assignee option previously required the name of an environment variable. But this was duplicating poorly the functionality of the githooks.userenv global option. So, I changed its meaning to now require a boolean (integer). If true it now checks if the authenticated_user (as inferred by the githooks.userenv option) is the current issue's assignee. [Incompatible Changes Affecting Plugin Developers] - The Git::Hooks routines grok_affected_refs, get_affected_refs, get_affected_ref_range, get_affected_ref_commit_ids, and get_affected_ref_commits were transformed in Git::More methods, so that they can now keep the affected_refs information inside the objects. - The Git::Hooks::grok_userenv routine was transformed into the Git::More::authenticated_user method. - The Git::Hooks::git_config routine was transformed into the Git::More::config method. - The method Git::More::get_commits now returns a list of commits and not an array-ref. This makes its usage simpler. [Fixes] - The tests are now performed out of the distribution directory. By performing them in the distribution directory we run the risk of messing up with Git::Hooks own git repository, which can interfere with the tests too. [Refactorings] - Got rid of global variables in Git::Hooks and all state variables used throughout. This had a great impact in the code, adding arguments to several routines, turning Git::Hooks routines into Git::More methods, adding new methods - The tests now prepare only the hooks that will be tested. Earlier we prepared all 16 hooks, which made the testing take longer. - The compatibility with old plugin names that was implemented some commits ago was made more specific, affecting just the plugins CheckAcls, CheckJira, and CheckStructure. Those were the plugins that existed before the plugin name change. 0.024 2012-12-17 12:35:52 America/Sao_Paulo - Implement a new plugin Git::Hooks::GerritChangeId which is a reimplementation of Gerrit's commit-msg official one (http://tinyurl.com/cglobb4, at Gerrit's v2.5.1). - Improve code and documentation with the help of Code::TidyAll, Perl::Critic, Pod::Checker, and Pod::Spell. 0.023 2012-12-16 08:47:55 America/Sao_Paulo - This version makes a large refactor in the code. The plugins were rewritten as proper modules so that they can be used by themselves, without the Git::Hooks framework. The only user visible change is that from now on the preferred way to configure plugins is by their CamelCase names (e.g. CheckJira instead of check-jira). But the old flattened names are still valid to keep compatibility with already set up repos. - This version starts to require App::gh::Git version 0.56 in order to have a working App::gh::Git. It also starts to require File::Path version 2.08 for the testing phase in order to have a working make_path routine. 0.022 2012-12-06 23:13:44 America/Sao_Paulo - Implement a new plugin called check-structure.pl which enforces the repository's file and reference structure. 0.021 2012-12-06 08:52:34 America/Sao_Paulo - The configuration variables userenv and admin, which were available in the check-acls and check-jira plugins were promoted to the "githooks" configuration section. Along with them, the functions grok_userenv, match_user, and im_admin were also migrated to the Git::Hooks module so that they can be used by any access control plugin. The old configuration variables in the plugins are still supported but are now documented as deprecated. - Also improved the documentation slightly. 0.020 2012-11-20 21:56:51 America/Sao_Paulo - Implement routine Git::Hooks::eval_gitconfig to make it easier to grok Perl expressions in config values. - Fix some problems in the test infrastructure. 0.019 2012-11-10 23:56:44 America/Sao_Paulo - Fix the post-receive hook which now gets the same input as pre-receive. This was reported to me by Mike South. Thanks again! 0.018 2012-11-06 21:49:20 America/Sao_Paulo - Fix a bug that prevented installed hooks to be invoked in the absence of any configured plugins. This was reported to me by Mike South. Thanks! 0.017 2012-10-31 10:45:10 America/Sao_Paulo - Just a bunch of fixes. 0.016 2012-09-13 22:34:05 America/Sao_Paulo - Interpolate environment variables in the whole ACL specification for check-acls. - Make the .pl extension optional in configuring plugins. - Make im_memberof an exported routine of Git::Hooks. - The group specification is now given by the githooks.groups variable. This is an incompatible change, since previously it was given by the check-acls.groups variable. - Implement Git::More::get_affected_files. This routine returns a hash mapping every affected file in a sequence of commits to a letter telling its affected status. - Allow check-acls.userenv be given by a code snippet to be evaluated. 0.015 2012-08-19 18:20:07 America/Sao_Paulo - ACLs in check-acls.pl can have environment variables interpolated in their refs components. 0.014 2012-08-16 23:00:38 America/Sao_Paulo - Implement reference specification by negated regexes in ACLs. - Clarify semantics of ACLs what component in the documentation. - Fix check-jira.matchlog usage. - Provide different messages when there are JIRAs cited but not from an expected project. 0.013 2012-07-27 17:11:17 America/Sao_Paulo - Require at least git 1.5 to work with. 0.012 2012-07-26 12:11:10 America/Sao_Paulo - Improve testing framework. 0.011 2012-07-25 11:12:01 America/Sao_Paulo - Improve testing framework. 0.010 2012-07-23 11:25:09 America/Sao_Paulo - Check if we have git installed before generating Makefile from Makefile.PL so that we avoid producing bogus cpantesters.org reports. 0.009 2012-07-22 11:21:18 America/Sao_Paulo - Show git version upon test failure. 0.008 2012-07-20 17:19:17 America/Sao_Paulo - Fix check-acls.pl to detect ref rewrites to non-related commits. 0.007 2012-07-17 08:59:31 America/Sao_Paulo - Fix still more errors detected by http://cpantesters.org/distro/G/Git-Hooks.html. 0.006 2012-07-16 17:29:12 America/Sao_Paulo - Enable pre 1.7.2 gits by using old-fashioned rev-list --pretty formats. 0.005 2012-07-16 10:17:16 America/Sao_Paulo - Fix some errors detected by http://cpantesters.org/distro/G/Git-Hooks.html. 0.004 2012-07-15 22:01:36 America/Sao_Paulo - Fix missing required dependency. 0.003 2012-07-15 18:33:20 America/Sao_Paulo - Fix dependency on App::gh::Git. 0.002 2012-07-11 America/Sao_Paulo - Implement support for driving external hooks. - Rename option githooks.hookdir to githooks.plugins. - Rename default local plugin directory from .git/hooks.d to .git/githooks. - Add option githooks.externals to disable external hooks processing. - Add option githooks.hooks to specify extra directories to look for external hooks. 0.001 2012-07-10 America/Sao_Paulo - First release, with two hooks passing tests: check-acls.pl and check-jira.pl. - I decided to incorporate Git::More in this distribution instead of making it a separate module. - The documentation is lacking and the functionality needs to be expanded.