1#!/bin/sh 2# 3# A generic git hook proxy. 4# https://git-scm.com/docs/githooks 5 6run() { 7 hook=$1 8 file=$2 9 10 n=$(echo "${file}" |sed "s/^.*${hook}\.//") 11 echo "running ${n} ${hook}" 12 ${file} 13} 14 15die() { 16 hook=$1 17 echo "${hook} hook did not succeed" >&2 18 exit 1 19} 20 21# Redirect output to stderr. 22exec 1>&2 23 24githooks='.githooks' 25basename=$(basename "$0") 26 27for f in $(cd ${githooks} && echo *); do 28 case "${f}" in 29 ${basename}.*) 30 run ${basename} "${githooks}/${f}" || die "${f}" 31 ;; 32 esac 33done 34