aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/setup-hooks
blob: f4d1b1ff004b061444156021eb101fe840f07471 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env bash

set -o errexit -o nounset -o pipefail
shopt -s inherit_errexit lastpipe

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/"