1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-06 07:35:29 +02:00
Chris Smith 66e58234ec [task/git-tools] Beginnings of a syntax checking hook.
Currently this hook checks line length is less than or equal to 80 characters.

PHPBB3-9768
2010-08-10 14:48:45 +01:00

27 lines
570 B
Bash
Executable File

#!/bin/sh
#
# A hook to check syntax of a phpBB3 commit message, per:
# * <http://wiki.phpbb.com/display/DEV/Git>
# * <http://area51.phpbb.com/phpBB/viewtopic.php?p=209919#p209919>
#
# This is a commit-msg hook.
#
# To install this you can either copy or symlink it to
# $GIT_DIR/hooks, example:
#
# ln -s ../../git-tools/hooks/commit-msg \\
# .git/hooks/commit-msg
status=0;
if [ "$(wc --max-line-length "$1" | cut -f1 -d" ")" -gt 80 ]
then
echo "The following lines are greater than 80 characters long:\n";
grep -nE '.{81,}' "$1";
status=1;
fi
exit $status;