#! /bin/sh HOOKS="pre-commit post-checkout" case `pwd` in */Util) cd ..;; esac if ! [ -d .git/hooks ] then echo "No directory for git hooks" >&2 exit 1 fi if metastore -h 2>/dev/null 1>&2 then echo "Installing in `pwd`/.git/hooks ..." >&2 cd .git/hooks for hook in $HOOKS do if [ -e $hook ] then if cmp -s ../../Util/git-$hook $hook then echo "$hook is already installed" >&2 else echo "Another $hook already exists" >&2 fi else ln -s ../../Util/git-$hook $hook chmod +x $hook fi done else echo "Did not find metastore, skipping hooks" >&2 fi exit 0