···11+# Git Hooks
22+33+This directory contains Git Hooks to validate contributions. You can install these hooks by
44+calling [`install-git-hooks.sh`](../install-git-hooks.sh).
55+66+See [the documentation for Git Hooks](https://git-scm.com/docs/githooks) for more information.
+14
localinfra/scripts/install-git-hooks.sh
···11+#!/bin/sh
22+script_dir="$(dirname "$(readlink -f "$0")")"
33+git_dir="$(git rev-parse --git-dir)"
44+55+for hook in "$script_dir"/git-hooks/*; do
66+ hook_base="$(basename "$hook")"
77+ if [ "$hook_base" = "readme.md" ]; then
88+ continue
99+ fi
1010+ hook_name="${hook_base%.*}"
1111+ hook_path="$git_dir/hooks/$hook_name"
1212+ echo "Installing '$hook' to '$hook_path'"
1313+ ln -s "$hook" "$hook_path"
1414+done