Git - inhibit commit if modules don't compile
Sometimes I forget to run Perl base tests for my modules, before committing changes. As to what happens, I end up committing something that doesn't quite compile ;)
Luckily Git has a pre-commit hook one can use to run at least the "compile" tests.
The following aborts the commit if the t/00*.t tests (usually the "do all modules compile?" tests) in the repository don't run correctly; stick it in
.git/hooks/pre-commit
:
#!/usr/bin/perl
# Runs modules' "compiles" tests before committing
# Dies (halting commit) if they don't compile
…