| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# This hook may be installed in .git/hooks (or ~/.git_template for future clones) |
| 4 |
# and additional/custom checks may be added if needed. |
| 5 |
|
| 6 |
function die() { |
| 7 |
rc=$1 |
| 8 |
shift; |
| 9 |
printf "*** GIT PRE-COMMIT HOOK FAILED ***:\n" |
| 10 |
echo "$@" |
| 11 |
exit $rc |
| 12 |
} |
| 13 |
|
| 14 |
if test -f contrib/git-hooks/check-versions.sh; then |
| 15 |
echo "=== Checking versions..." |
| 16 |
./contrib/git-hooks/check-versions.sh || die $? "Versions are not up to date" |
| 17 |
else |
| 18 |
echo "=== No check-versions.sh script -- skipping" |
| 19 |
fi |
| 20 |
|
| 21 |
if test -f contrib/git-hooks/check-manpages-completions.pl; then |
| 22 |
echo "=== Checking manpages and completions..." |
| 23 |
./contrib/git-hooks/check-manpages-completions.pl || die $? "Manpages or completions are not up to date" |
| 24 |
else |
| 25 |
echo "=== No check-manpages-completions.pl script -- skipping" |
| 26 |
fi |
| 27 |
|
| 28 |
# If we have a copyright-checking script, run it |
| 29 |
if test -x ./contrib/update-my-copyright.pl; then |
| 30 |
echo "=== Checking copyrights..." |
| 31 |
./contrib/update-my-copyright.pl --check-only --quiet || die $? "Copyrights are not up to date" |
| 32 |
else |
| 33 |
echo "=== No update-my-copyright.pl script -- skipping" |
| 34 |
fi |