blob: 2a7df53c685849cab6a5e19d864aa019fe6387c0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/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 )"
readonly script_dir
setup_clang_format_hook() {
local gitdir
gitdir="$( git rev-parse --git-dir )"
local hooks_dir
hooks_dir="$gitdir/hooks"
local symlink_dest
symlink_dest="$( realpath "--relative-to=$hooks_dir" -- "$script_dir/pre-commit.sh" )"
ln -fs -- "$symlink_dest" "$hooks_dir/pre-commit"
}
main() {
cd -- "$script_dir"
setup_clang_format_hook
}
main
|