Git::MoreHooks::GitRepoAdmin - Integrate with .git-repo-admin
version 0.018
Git::MoreHooks::GitRepoAdmin is a plugin for Git::Hooks.
This plugin works with .git-admin-repo.
It has several functions:
Server Side
On server side during git push it updates the Git hooks automatically when there is configuration changes, i.e. when the VERSION file is updated with a greater number than earlier.
git push
Client Side
On client side during git pull it only informs the user when there is configuration changes. It does not perform any changes to user's repo.
git pull
Package Git::MoreHooks is currently being developed so changes in the existing hooks are possible.
To enable GitRepoAdmin plugin, you need to add it to the githooks.plugin configuration option:
git config --add githooks.plugin Git::MoreHooks::GitRepoAdmin
GitRepoAdmin plugin attaches itself to the following Git hooks:
post-merge
This hook is invoked by git-merge, which happens when a git pull is done on a local repository.
post-receive
This hook is invoked by git-receive-pack when it reacts to git push and updates reference(s) in its repository. It executes on the remote repository once after all the refs have been updated.
This plugin is configured by the following git options.
By default this plugin only reacts to updates on branches main or master. If you want to react to some other refs (usually some branch under refs/heads/), you may specify them with one or more instances of this option. N.B. Other good candidates are, for instance, branches develop and release.
The refs can be specified as a complete ref name (e.g. "refs/heads/master") or by a regular expression starting with a caret (^), which is kept as part of the regexp (e.g. "^refs/heads/(master|fix)").
^
Default value for REFSPEC is [ '^refs/heads/main$', '^refs/heads/master$' ].
N.B. REFSPEC must not match two or more branch names in the repo.
N.B.2. Due to the latest change of default branch name from master to main, both names are now supported by default. However, as above, the repository must not have both of them. If you want to have both of them, then you must define REFSPEC to match only one.
This module exports the following routines that can be used directly without using all of Git::Hooks infrastructure.
This is the routine used to implement the post-merge hook. It needs a Git::More object and an integer telling if this was a squash merge (1) or not (0).
Git::More
This is the routing used to implement the post-receive hook. It needs a Git::More object.
Thanks go to Gustavo Leite de Mendonça Chaves for his Git::Hooks package.
No known bugs.
'Mikko Koivunalho <mikkoi@cpan.org>'
This software is copyright (c) 2022 by Mikko Koivunalho.
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::MoreHooks, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Git::MoreHooks
CPAN shell
perl -MCPAN -e shell install Git::MoreHooks
For more information on module installation, please visit the detailed CPAN module installation guide.