Git::Hooks

A framework for implementing Git hooks
Download

Git::Hooks Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Gustavo Leite de Mendonca Chaves
  • Publisher web site:
  • http://search.cpan.org/~gnustavo/

Git::Hooks Tags


Git::Hooks Description

"Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals. (https://github.com/gitster/git#readme)".In order to really understand what this is all about you need to understand Git http://git-scm.org/ and its hooks. You can read everything about this in the documentation references on that site http://git-scm.com/documentation.A hook is a specifically named program that is called by the git program during the execution of some operations. At the last count, there were exactly 16 different hooks which can be used (http://schacon.github.com/git/githooks.html). They must reside under the .git/hooks directory in the repository. When you create a new repository, you get some template files in this directory, all of them having the .sample suffix and helpful instructions inside explaining how to convert them into working hooks.When Git is performing a commit operation, for example, it calls these four hooks in order: pre-commit, prepare-commit-msg, commit-msg, and post-commit. The first three can gather all sorts of information about the specific commit being performed and decide to reject it in case it doesn't comply to specified policies. The post-commit can be used to log or alert interested parties about the commit just done.There are several useful hook scripts available elsewhere, e.g. https://github.com/gitster/git/tree/master/contrib/hooks and http://google.com/search?q=git+hooks. However, when you try to combine the functionality of two or more of those scripts in a single hook you normally end up facing two problems.SYNOPSISA single script can implement several Git hooks: #!/usr/bin/env perl use Git::Hooks; PRE_COMMIT { my ($git) = @_; # ... }; COMMIT_MSG { my ($git, $msg_file) = @_; # ... }; run_hook($0, @ARGV);Or you can use Git::Hooks plugins or external hooks, driven by the single script below. These hooks are enabled by Git configuration options. (More on this later.) #!/usr/bin/env perl use Git::Hooks; run_hook($0, @ARGV);Product's homepage


Git::Hooks Related Software