NAME
Dist::Conformance::Check::GitHooks - The git hooks are tracked, match their templates, and are installed
VERSION
version 0.002
DESCRIPTION
Git neither versions nor clones hooks, so the hooks of the harness are tracked in a directory of the repository, and each clone installs them.
The check fails when a hook is missing from directory. It reports differ when a hook is there and its blob SHA differs from the SHA of its template: the repository customized it, or it is older. Otherwise it passes. It compares SHAs, so it reads no hook from a remote snapshot.
The update writes each missing hook from its template, executable. It overwrites a hook that differs only when replace is true. Then, when install is true, it installs each hook into .git/hooks of the checkout, or of the main checkout of a worktree, unless the installed hook is the same. The check cannot see .git/hooks, so a clone that never installed them passes the check and still gets them from the update.
METHODS
hook_path
($name). The path of the hook $name in the repository.
check
update
Writes the missing hooks, replaces those that differ if replace, and installs them if install.
IN A FLAVOR
checks:
GitHooks:
directory: git-hooks
hooks:
pre-commit: templates/pre-commit
post-commit: templates/post-commit
differ: info
replace: false
install: true
CONFIGURATION
- directory
-
Required. The directory of the repository that holds the hooks.
- hooks
-
Required. A mapping from each hook name, such as
pre-commit, to its template. - differ
-
The status of a hook that differs from its template. Default
info. - replace
-
Whether an update overwrites a hook that differs. Default false.
- install
-
Whether an update installs the hooks into the checkout. Default true.
SEE ALSO
Please see those modules/websites for more information related to this module.
BUGS
Please report any bugs or feature requests on the bugtracker website https://github.com/Troglodyne-Internet-Widgets/Dist-Conformance/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHORS
Current Maintainers:
George S. Baugh <george@troglodyne.net>
COPYRIGHT AND LICENSE
Copyright (c) 2026 Troglodyne LLC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.