NBash
1#!/bin/sh
2#
3# An example hook script to make use of push options.
4# The example simply echoes all push options that start with 'echoback='
5# and rejects all pushes when the "reject" push option is used.
6#
7# To enable this hook, rename this file to "pre-receive".
8
9if test -n "$GIT_PUSH_OPTION_COUNT"
10then
11i=0
12while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
13do
14eval "value=\$GIT_PUSH_OPTION_$i"
15case "$value" in
16echoback=*)
17echo "echo from the pre-receive-hook: ${value#*=}" >&2
18;;
19reject)
20exit 1
21esac
22i=$((i + 1))
23done
24fi
25