Add boilerplate checking to hook

This commit is contained in:
Daniel Smith
2014-06-23 11:34:44 -07:00
parent b850d36166
commit 756ba6958d
3 changed files with 36 additions and 0 deletions

13
hooks/boilerplate.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
# Print 1 if the file in $1 has the correct boilerplate header, 0 otherwise.
FILE=$1
LINES=$(cat "$(dirname $0)/boilerplate.txt" | wc -l)
DIFFER=$(head -$LINES "${FILE}" | diff -q - "$(dirname $0)/boilerplate.txt")
if [[ -z "${DIFFER}" ]]; then
echo "1"
exit 0
fi
echo "0"