aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/setup-hooks
blob: 745c7c7c41fe6d52cb21854f861a27688339e500 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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/"