aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2007-04-16 08:31:35 +0000
committerJunio C Hamano <junkio@cox.net>2007-04-16 01:35:39 -0700
commit91776491da19f1b72e1cd192c9ea42bb1aae4415 (patch)
treeee954e0319dc6cd529765f99138f7527a2b455b7 /templates
parent5946d88a349407f2830b4d186201076b80a7cce4 (diff)
downloadgit-91776491da19f1b72e1cd192c9ea42bb1aae4415.tar.gz
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>
Diffstat (limited to 'templates')
-rw-r--r--templates/hooks--update7
1 files changed, 6 insertions, 1 deletions
diff --git a/templates/hooks--update b/templates/hooks--update
index 0dcb1adb13..9d3795c6d0 100644
--- a/templates/hooks--update
+++ b/templates/hooks--update
@@ -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 [ -z "${newrev##0*}" ]; then
+ newrev_type=commit
+else
+ newrev_type=$(git-cat-file -t $newrev)
+fi
case "$refname","$newrev_type" in
refs/tags/*,commit)