Have sample update hook not refuse deleting a branch through push.

source ref might be 0000...0000 to delete a branch through git-push,
'git <remote> push :<branch>'.  The update hook should not decline this.

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Gerrit Pape 2007-04-16 08:31:35 +00:00 committed by Junio C Hamano
parent 5946d88a34
commit 91776491da

View File

@ -41,7 +41,12 @@ if [ -z "$projectdesc" -o "$projectdesc" = "Unnamed repository; edit this file t
fi fi
# --- Check types # --- Check types
# 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) newrev_type=$(git-cat-file -t $newrev)
fi
case "$refname","$newrev_type" in case "$refname","$newrev_type" in
refs/tags/*,commit) refs/tags/*,commit)