Code

filter-branch: subdirectory filter needs --full-history
[git.git] / templates / hooks--update
index 0ff03309e69aed6b506e333e087f23099ad80290..9d3795c6d055d3ca2b50ac0607607037cb2b8142 100644 (file)
@@ -34,13 +34,19 @@ fi
 allowunannotated=$(git-repo-config --bool hooks.allowunannotated)
 
 # check for no description
+projectdesc=$(sed -e '1p' "$GIT_DIR/description")
 if [ -z "$projectdesc" -o "$projectdesc" = "Unnamed repository; edit this file to name it for gitweb" ]; then
        echo "*** Project description file hasn't been set" >&2
        exit 1
 fi
 
 # --- Check types
-newrev_type=$(git-cat-file -t $newrev)
+# if $newrev is 0000...0000, it's a commit to delete a branch
+if [ -z "${newrev##0*}" ]; then
+       newrev_type=commit
+else
+       newrev_type=$(git-cat-file -t $newrev)
+fi
 
 case "$refname","$newrev_type" in
        refs/tags/*,commit)