From: Geoffrey Thomas Date: Fri, 8 May 2009 04:17:32 +0000 (-0400) Subject: Don't crash when a branch is created. X-Git-Url: https://snippets.scripts.mit.edu/gitweb.cgi/Scripts/git/.git/commitdiff_plain/d0ef17b3aae0b08bdc68a339f9a916493aaf6e00 Don't crash when a branch is created. 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 --- diff --git a/git-hooks/zephyr-post-receive b/git-hooks/zephyr-post-receive index 7e06b30..e7b70d9 100755 --- a/git-hooks/zephyr-post-receive +++ b/git-hooks/zephyr-post-receive @@ -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" |