3 # This script is run after receive-pack has accepted a pack and the
4 # repository has been updated. It is passed arguments in through stdin
6 # <oldrev> <newrev> <refname>
8 # aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
10 export LC_ALL=en_US.UTF-8
12 class=`git config zephyr.class`
13 instance=`git config zephyr.instance`
14 zsig=`git config zephyr.zsig`
15 color=`git config --bool zephyr.color`
16 maxlines=`git config --int zephyr.maxlines 2>/dev/null || echo 50`
18 if [ "${color:-true}" = "true" ]; then
24 if [ -z "$zsig" ]; then
25 if [ -e "$GIT_DIR/description" ]; then
26 zsig=`cat "$GIT_DIR/description"`
28 if [ -z "$zsig" ] || \
29 [ "$zsig" = "Unnamed repository; edit this file to name it for gitweb." ] || \
30 [ "$zsig" = "Unnamed repository; edit this file 'description' to name the repository." ]; then
31 zsig=$(basename "$(cd "$GIT_DIR" && pwd)")
32 if [ "$zsig" = ".git" ]; then
33 zsig=$(basename "$(cd "$GIT_DIR/.." && pwd)")
38 if [ -z "$class" ]; then
39 echo "I don't know where to send a commit zephyr!" >&2
40 echo "Please set the zephyr.class config variable in" >&2
41 echo "$PWD/config." >&2
48 zwrite -c "$class" -i "${instance:-git}" -s "Aperture Science Emergency Intelligence Incinerator" -d \
49 -m 'Aborting zephyr hook to prevent zwrite flood.'
54 while read oldrev newrev refname; do
55 if [ "$oldrev" = "0000000000000000000000000000000000000000" ]; then
58 zwrite -c "$class" -i "${instance:-${refname#refs/heads/}}" -s "$zsig: $refname" -d \
59 -m "New branch $refname created, currently at $newrev."
64 shortrev=`git log -1 --pretty=format:%h "$rev"`
65 lines=`git show -M "$rev" | wc -l`
66 if [ $lines -lt $maxlines ]; then
71 (git show -M $stat $usecolor "$rev" |
75 -e 's/
\e\[1m/}@b{/g' \
76 -e 's/
\e\[33m/@color(yellow)/g' \
77 -e 's/
\e\[31m/@color(red)/g' \
78 -e 's/
\e\[32m/@color(green)/g' \
79 -e 's/
\e\[36m/@color(cyan)/g' \
82 zwrite -c "$class" -i "${instance:-$shortrev}" -s "$zsig: $refname" -d
83 done < <(git rev-list --first-parent --reverse "$oldrev..$newrev")