]> snippets.scripts.mit.edu Git - Scripts/git/.git/blame - git-hooks/zephyr-post-receive
git-hooks: Support specifying a zephyr instance
[Scripts/git/.git] / git-hooks / zephyr-post-receive
CommitLineData
5b11b497
GT
1#!/bin/sh
2#
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
5# in the form
6# <oldrev> <newrev> <refname>
7# For example:
8# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
9
10class=`git config zephyr.class`
916beed8 11instance=`git config zephyr.instance`
5b11b497
GT
12zsig=`git config zephyr.zsig`
13if [ -z "$class" ]; then
14 echo "I don't know where to send a commit zephyr!" >&2
15 echo "Please set the zephyr.class config variable in" >&2
16 echo "$PWD/config." >&2
17 exit 1
18fi
19while read oldrev newrev refname; do
20 git-rev-list --reverse "$oldrev..$newrev" | while read rev; do
21 shortrev=`git log -1 --pretty=format:%h "$rev"`
22 (git show --stat --color "$rev" |
23 sed "s/@/@@/g" |
24 sed "s/\e\[m/@color(default)/g" |
25 sed "s/\e\[33m/@color(yellow)/g" |
26 sed "s/\e\[31m/@color(red)/g" |
27 sed "s/\e\[32m/@color(green)/g") |
916beed8 28 zwrite -c "$class" -i "${instance:-$shortrev}" -s "${zsig:-Git}: $refname" -d
5b11b497
GT
29 done
30done