X-Git-Url: https://sipb.mit.edu/gitweb.cgi/snippets/.git/blobdiff_plain/5b11b497328f5168100a837b9f13c1f97f0074a7..f9d64b9ddda45bddfaf1267730b1b427de88c975:/git-hooks/zephyr-post-receive?ds=sidebyside diff --git a/git-hooks/zephyr-post-receive b/git-hooks/zephyr-post-receive index 0b2fde4..7e06b30 100755 --- a/git-hooks/zephyr-post-receive +++ b/git-hooks/zephyr-post-receive @@ -8,7 +8,16 @@ # aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master class=`git config zephyr.class` +instance=`git config zephyr.instance` zsig=`git config zephyr.zsig` +color=`git config --bool zephyr.color` + +if [ "${color:-true}" = "true" ]; then + usecolor="--color" +else + usecolor="" +fi + 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 @@ -18,12 +27,15 @@ 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 + (git show --stat $usecolor "$rev" | + sed -e 's/@/@@/g' \ + -e 's/}/@(})/g' \ + -e 's/\[m/}@{/g' \ + -e 's/\[33m/@color(yellow)/g' \ + -e 's/\[31m/@color(red)/g' \ + -e 's/\[32m/@color(green)/g' \ + -e '1s/^/@{/' \ + -e '$s/$/}/') | + zwrite -c "$class" -i "${instance:-$shortrev}" -s "${zsig:-Git}: $refname" -d done done