]> sipb.mit.edu Git - snippets/.git/commitdiff
Don't crash when a branch is created.
authorGeoffrey Thomas <geofft@mit.edu>
Fri, 8 May 2009 04:17:32 +0000 (00:17 -0400)
committerGeoffrey Thomas <geofft@mit.edu>
Fri, 8 May 2009 04:17:32 +0000 (00:17 -0400)
It doesn't give you particularly useful output, and it doesn't handle
the case of a branch being deleted. But it's a little better.

Signed-off-by: Geoffrey Thomas <geofft@mit.edu>
git-hooks/zephyr-post-receive

index 7e06b30b72578ed000690b663b4b1674047ac82d..e7b70d9f13fe21264dfdb5447fae3ed1bfff7e9c 100755 (executable)
@@ -25,6 +25,12 @@ if [ -z "$class" ]; then
   exit 1
 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."
+    continue
+  fi
   git-rev-list --reverse "$oldrev..$newrev" | while read rev; do
     shortrev=`git log -1 --pretty=format:%h "$rev"`
     (git show --stat $usecolor "$rev" |