17 lines
424 B
Bash
Executable File
17 lines
424 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)
|
|
HOOK_DIR="${REPO_ROOT}/.git/hooks"
|
|
|
|
if [[ ! -d "${HOOK_DIR}" ]]; then
|
|
echo "This script must be run inside a git repository." >&2
|
|
exit 1
|
|
fi
|
|
|
|
for hook in pre-commit post-commit pre-push; do
|
|
ln -sf "${REPO_ROOT}/scripts/hooks/${hook}" "${HOOK_DIR}/${hook}"
|
|
chmod +x "${HOOK_DIR}/${hook}"
|
|
echo "Installed ${hook} hook"
|
|
done
|