robot-u-site/scripts/install_git_hooks.sh

12 lines
368 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
if ! git -C "${root_dir}" rev-parse --git-dir >/dev/null 2>&1; then
echo "Skipping git hook install because ${root_dir} is not a git repository."
exit 0
fi
git -C "${root_dir}" config core.hooksPath .githooks
echo "Installed git hooks from ${root_dir}/.githooks"