From 894ebcbf26478ea7fd26b89636b53ecd2a750643 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 7 Sep 2022 13:17:52 +0200 Subject: add scripts (pre-commit hook, etc.) --- scripts/setup-hooks | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 scripts/setup-hooks (limited to 'scripts/setup-hooks') 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/" -- cgit v1.2.3