aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/setup-hooks
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-09-07 13:17:52 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2022-09-07 13:17:52 +0200
commit894ebcbf26478ea7fd26b89636b53ecd2a750643 (patch)
tree00904bb81fc0a631ae216c187385af73838f9c22 /scripts/setup-hooks
parentci: set some environment variables (diff)
downloadcimple-894ebcbf26478ea7fd26b89636b53ecd2a750643.tar.gz
cimple-894ebcbf26478ea7fd26b89636b53ecd2a750643.zip
add scripts (pre-commit hook, etc.)
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/"