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