diff --git a/githooks/pre-commit b/githooks/pre-commit index ab5d36d..53b3fec 100755 --- a/githooks/pre-commit +++ b/githooks/pre-commit @@ -1,5 +1,7 @@ #!/bin/sh +filter=$(git config hooks.filter) +validation=$(git config hooks.validation) indentation=$(git config hooks.indentation) temp=$(mktemp -p /dev/shm -d -t git-hook.XXXX) export GIT_DIR=$(git rev-parse --show-toplevel)/.git @@ -22,6 +24,18 @@ check() { git checkout-index --prefix="$temp/index/" --all cd $temp/index/ + +if [ -n "$filter" ]; then + ln -s $GIT_DIR/ .git + $filter + git add --all + rm -rf .git +fi + +if [ -n "$validation" ]; then + $validation || error=1 +fi + case $indentation in tab|tabs) echo "Checking tab indentation"