1. Stefan Saasen
  2. git


Gerrit Pape  committed 9177649

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>

  • Participants
  • Parent commits 5946d88
  • Branches master

Comments (0)

Files changed (1)

File templates/hooks--update

View file
 # --- 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
+	newrev_type=$(git-cat-file -t $newrev)
 case "$refname","$newrev_type" in