for-each-ref: fix off by one read.
[gitweb.git] / templates / hooks--update
index 0dcb1adb132d5d127bc6c693bac1528cb567e517..d8c76264beaf198f1f3558ca8429349c8eab9ead 100644 (file)
@@ -41,7 +41,12 @@ if [ -z "$projectdesc" -o "$projectdesc" = "Unnamed repository; edit this file t
 fi
 
 # --- Check types
-newrev_type=$(git-cat-file -t $newrev)
+# if $newrev is 0000...0000, it's a commit to delete a branch
+if [ "$newrev" = "0000000000000000000000000000000000000000" ]; then
+       newrev_type=commit
+else
+       newrev_type=$(git-cat-file -t $newrev)
+fi
 
 case "$refname","$newrev_type" in
        refs/tags/*,commit)