aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/setup-hooks
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/setup-hooks')
-rwxr-xr-xscripts/setup-hooks15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/setup-hooks b/scripts/setup-hooks
new file mode 100755
index 0000000..745c7c7
--- /dev/null
+++ b/scripts/setup-hooks
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+set -o errexit -o nounset -o pipefail
+
+script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
+script_dir="$( cd -- "$script_dir" && pwd )"
+
+cd -- "$script_dir"
+
+gitdir="$( git rev-parse --git-dir )"
+hooks_dir="$gitdir/hooks"
+
+symlink_dest="$( realpath "--relative-to=$hooks_dir" -- "$script_dir/pre-commit" )"
+
+ln -fs -- "$symlink_dest" "$hooks_dir/"