1#!/bin/sh 2 3cd $(dirname $0) 4 5REPO_ROOT=$(git rev-parse --show-toplevel) 6RESOLVE_REPO_ROOT_STATUS=$? 7if [ "$RESOLVE_REPO_ROOT_STATUS" -ne "0" ]; then 8 echo -e "Unable to resolve repository root. Error:\n$REPO_ROOT" > /dev/stderr 9 exit $RESOLVE_REPO_ROOT_STATUS 10fi 11 12set -e 13set -x 14 15# Just in case the directory doesn't exist 16mkdir -p $REPO_ROOT/.git/hooks 17 18ln -f -s $(pwd)/pre-commit $REPO_ROOT/.git/hooks/pre-commit