summaryrefslogtreecommitdiff
path: root/templates/hooks--update
diff options
context:
space:
mode:
Diffstat (limited to 'templates/hooks--update')
-rw-r--r--templates/hooks--update8
1 files changed, 7 insertions, 1 deletions
diff --git a/templates/hooks--update b/templates/hooks--update
index 0ff0330..9d3795c 100644
--- a/templates/hooks--update
+++ b/templates/hooks--update
@@ -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)