Improve zephyr notifications
authorQuentin Smith <quentin@mit.edu>
Thu, 26 Aug 2010 01:04:53 +0000 (21:04 -0400)
committerQuentin Smith <quentin@mit.edu>
Sat, 15 Oct 2011 15:43:51 +0000 (11:43 -0400)
debian/changelog
git-hooks/sub/zephyr-post-receive

index feb6cba..4d07161 100644 (file)
@@ -1,3 +1,9 @@
+invirt-dev (0.1.10) unstable; urgency=low
+
+  * Improve zephyr notifications
+
+ -- Quentin Smith <quentin@mit.edu>  Wed, 25 Aug 2010 21:04:43 -0400
+
 invirt-dev (0.1.9.1) unstable; urgency=low
 
   * Revert 0.1.9: our sbuild is not new enough to support that.
index da91abe..3cb2086 100755 (executable)
@@ -14,6 +14,10 @@ instance=$(invirt-getconf "$base.instance" 2>/dev/null)
 zsig=$(invirt-getconf "$base.zsig" 2>/dev/null)
 color=$(invirt-getconf "$base.color" 2>/dev/null)
 
+# Git hooks are always called with PWD == GIT_DIR.
+repo=${PWD#/srv/git/}
+repo=${repo%/.git}
+
 if [ "${color:-true}" = "true" ]; then
     usecolor="--color"
 else
@@ -29,8 +33,8 @@ fi
 while read oldrev newrev refname; do
   if [ "$oldrev" = "0000000000000000000000000000000000000000" ]; then
     # dammit git
-    zwrite -c "$class" -i "$(basename "$refname")" -s "${zsig:-Git}: $refname" -d \
-      -m "New branch created."
+    zwrite -c "$class" -i "$repo" -s "${zsig:-Git}: $refname" -d \
+      -m "New branch ${refname#refs/heads/} created."
     continue
   fi
   git rev-list --first-parent --reverse "$oldrev..$newrev" | while read rev; do
@@ -44,6 +48,6 @@ while read oldrev newrev refname; do
          -e 's/\e\[32m/@color(green)/g' \
          -e '1s/^/@{/' \
          -e '$s/$/}/') |
-    zwrite -c "$class" -i "${instance:-$shortrev}" -s "${zsig:-Git}: $refname" -d
+    zwrite -c "$class" -i "${instance:-$repo/$shortrev}" -s "${zsig:-Git}: $refname" -d
   done
 done