blob: 454f3cdd7ebab7d2cc11b3ccc7b07210d7f945cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/bin/bash
# install-hooks — Symlink version-controlled hooks into .git/hooks/
# Usage: ./scripts/install-hooks
# Example: ./scripts/install-hooks
set -euo pipefail
REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)"
HOOKS_SRC="${REPO_DIR}/scripts/hooks"
HOOKS_DST="${REPO_DIR}/.git/hooks"
for hook in "${HOOKS_SRC}"/*; do
name="$(basename "${hook}")"
target="${HOOKS_DST}/${name}"
if [ -e "${target}" ] && [ ! -L "${target}" ]; then
echo " skipping ${name}: non-symlink already exists at ${target}"
continue
fi
ln -sf "${hook}" "${target}"
echo " installed ${name}"
done
echo "==> Hooks installed."
|