From: Geoffrey Thomas Date: Sun, 1 Feb 2009 15:35:40 +0000 (-0500) Subject: git zephyr post receive hook X-Git-Url: https://snippets.scripts.mit.edu/gitweb.cgi/Scripts/git/.git/commitdiff_plain/5b11b497328f5168100a837b9f13c1f97f0074a7 git zephyr post receive hook --- diff --git a/git-hooks/zephyr-post-receive b/git-hooks/zephyr-post-receive new file mode 100755 index 0000000..0b2fde4 --- /dev/null +++ b/git-hooks/zephyr-post-receive @@ -0,0 +1,29 @@ +#!/bin/sh +# +# This script is run after receive-pack has accepted a pack and the +# repository has been updated. It is passed arguments in through stdin +# in the form +# +# For example: +# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master + +class=`git config zephyr.class` +zsig=`git config zephyr.zsig` +if [ -z "$class" ]; then + echo "I don't know where to send a commit zephyr!" >&2 + echo "Please set the zephyr.class config variable in" >&2 + echo "$PWD/config." >&2 + exit 1 +fi +while read oldrev newrev refname; do + git-rev-list --reverse "$oldrev..$newrev" | while read rev; do + shortrev=`git log -1 --pretty=format:%h "$rev"` + (git show --stat --color "$rev" | + sed "s/@/@@/g" | + sed "s/\[m/@color(default)/g" | + sed "s/\[33m/@color(yellow)/g" | + sed "s/\[31m/@color(red)/g" | + sed "s/\[32m/@color(green)/g") | + zwrite -c "$class" -i "$shortrev" -s "$zsig: $refname" -d + done +done