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 base=build.hooks.post_commit.zephyr
12 class=$(invirt-getconf "$base.class" 2>/dev/null)
13 instance=$(invirt-getconf "$base.instance" 2>/dev/null)
14 zsig=$(invirt-getconf "$base.zsig" 2>/dev/null)
15 color=$(invirt-getconf "$base.color" 2>/dev/null)
17 # Git hooks are always called with PWD == GIT_DIR.
21 if [ "${color:-true}" = "true" ]; then
27 if [ -z "$class" ]; then
28 echo "I don't know where to send a commit zephyr!" >&2
29 echo "Please provide a value for $base.class in" >&2
30 echo "your invirt config file." >&2
33 while read oldrev newrev refname; do
34 if [ "$oldrev" = "0000000000000000000000000000000000000000" ]; then
36 zwrite -c "$class" -i "$repo" -s "${zsig:-Git}: $refname" -d \
37 -m "New branch ${refname#refs/heads/} created."
40 git rev-list --first-parent --reverse "$oldrev..$newrev" | while read rev; do
41 shortrev=`git log -1 --pretty=format:%h "$rev"`
42 (git show --stat -M $usecolor "$rev" |
46 -e 's/
\e\[33m/@color(yellow)/g' \
47 -e 's/
\e\[31m/@color(red)/g' \
48 -e 's/
\e\[32m/@color(green)/g' \
51 zwrite -c "$class" -i "${instance:-$repo/$shortrev}" -s "${zsig:-Git}: $refname" -d