aboutsummaryrefslogtreecommitdiff
path: root/.githooks/generic
blob: b5f3e4c03d5be04bbcf33ae432ea92a195a02e80 (plain)
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
28
#!/bin/sh
#
# A generic git hook proxy.
# https://git-scm.com/docs/githooks

run() {
	hook=$1
	file=$2

  n=$(echo "${file}" |sed "s/^.*${hook}\.//")
	echo "running ${n} ${hook}"
	${file}
}

# Redirect output to stderr.
exec 1>&2

githooks='.githooks'
basename=$(basename "$0")

for f in $(cd ${githooks} && echo *); do
	case "${f}" in
	pre-commit.*)
    # Called by "git commit" with no arguments.
    [ "${basename}" = 'pre-commit' ] && run pre-commit "${githooks}/${f}"
    ;;
  esac
done