diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg new file mode 100644 index 000000000..468243a2c --- /dev/null +++ b/PREUPLOAD.cfg @@ -0,0 +1,2 @@ +[Hook Scripts] +whitespace = tools/whitespace.sh ${PREUPLOAD_FILES} diff --git a/tools/whitespace.sh b/tools/whitespace.sh new file mode 100755 index 000000000..5fb4a2f4e --- /dev/null +++ b/tools/whitespace.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +RESULT=0 + +for i in "$@"; do + a="`tail -c 1 "$i"`" + if [ "$a" != "" ]; then + echo "$i does not have a trailing newline" 1>&2 + RESULT=-1 + fi +done + +exit $RESULT