summaryrefslogtreecommitdiff
path: root/set-up-post-receive-hooks.sh
blob: 936df41a3017348a6fb196d303af18b90797a53c (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
#!/bin/sh

cd /git/$1
if [ ! -e git-daemon-export-ok -o ! -e HEAD -o ! -e $(awk '{ print $2 }' HEAD) ]; then
	exit
fi

[ -e hooks/post-receive.d ] && exit

mkdir hooks/post-receive.d
cat <<EOF > hooks/post-receive-new-$$
#!/bin/sh

set -e

for f in hooks/post-receive.d/*; do
	[ -x \$f ] && \$f "\$@"
done

EOF

[ -e hooks/post-receive ] && mv hooks/post-receive hooks/post-receive.d/00-post-receive
ln -s /git/bin/post-receive-mirror-github hooks/post-receive.d/01-github

mv hooks/post-receive-new-$$ hooks/post-receive
chmod +x hooks/post-receive