summaryrefslogtreecommitdiff
path: root/bin/git-pre-commit-hook
blob: 81ace2cd2cd082ae2995e248788d98760b6e7eea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

# copy (DO NOT SYMLINK) this file to .git/hooks/pre-commit
# to check style on all modified files before allowing the commit to complete
#
# DO NOT SYMLINK
# DO NOT SYMLINK
# DO NOT SYMLINK (why? security risk)

cd $(dirname "$0")/../..

errors=$(git diff --cached | bin/style-check --diff 2>&1)

if [ "$?" != "0" ]; then
    echo "$errors"
    exit 1
fi