3 # Install all the client hooks
5 BASE_DIR="$(cd $(dirname $0); pwd -P)"
6 HOOK_NAMES="applypatch-msg pre-applypatch post-applypatch pre-commit prepare-commit-msg commit-msg post-commit pre-rebase post-checkout post-merge pre-receive update post-receive post-update pre-auto-gc"
7 HOOK_DIR="$(git rev-parse --show-toplevel)/.git/hooks"
9 for hook in $HOOK_NAMES; do
11 shipped_hook="$BASE_DIR/$hook"
12 installed_hook="$HOOK_DIR/$hook"
14 # If we don't distribute it, continue
15 if [ ! -f "$shipped_hook" ]; then
19 if [ -h "$installed_hook" ]; then
20 echo "$installed_hook is a symlink - replacing."
21 elif [ -e "$installed_hook" ]; then
22 echo "$installed_hook hook already exists."
27 echo "ln -s -f \"$shipped_hook\" \"$installed_hook\""
28 ln -s -f "$shipped_hook" "$installed_hook"