#!/bin/sh # # An example hook script to verify what is about to be committed. # Called by "git commit" with no arguments. The hook should # exit with non-zero status after issuing an appropriate message if # it wants to stop the commit. # if git rev-parse --verify HEAD >/dev/null 2>&1 then AGAINST=HEAD else # Initial commit: diff against an empty tree object AGAINST=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi FILES=$(git diff --cached --name-only $AGAINST); for FILE in $FILES; do STAT="$(stat -f "%A" $FILE)" if [ "$STAT" -ne "644" ] ; then echo "git pre-commit check failed: file $FILE should be 644 not $STAT" STATUS=1 fi done exit $STATUS