Skip to content

Commit

Permalink
Have sample update hook not refuse deleting a branch through push.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gerrit Pape authored and Junio C Hamano committed Apr 16, 2007
1 parent 5946d88 commit 9177649
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion templates/hooks--update
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9177649

Please sign in to comment.