Merge branch 'hv/sample-update'

* hv/sample-update:
  Extend sample update hook, disable modifying of existing tags
This commit is contained in:
Junio C Hamano 2009-05-23 01:39:15 -07:00
Родитель 2beba6beb0 7742c65ba5
Коммит 5eb3d94553
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -13,6 +13,9 @@
# hooks.allowdeletetag # hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the # This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be. # repository. By default they won't be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won't be.
# hooks.allowdeletebranch # hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the # This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be. # repository. By default they won't be.
@ -44,6 +47,7 @@ allowunannotated=$(git config --bool hooks.allowunannotated)
allowdeletebranch=$(git config --bool hooks.allowdeletebranch) allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
denycreatebranch=$(git config --bool hooks.denycreatebranch) denycreatebranch=$(git config --bool hooks.denycreatebranch)
allowdeletetag=$(git config --bool hooks.allowdeletetag) allowdeletetag=$(git config --bool hooks.allowdeletetag)
allowmodifytag=$(git config --bool hooks.allowmodifytag)
# check for no description # check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description") projectdesc=$(sed -e '1q' "$GIT_DIR/description")
@ -82,6 +86,12 @@ case "$refname","$newrev_type" in
;; ;;
refs/tags/*,tag) refs/tags/*,tag)
# annotated tag # annotated tag
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
then
echo "*** Tag '$refname' already exists." >&2
echo "*** Modifying a tag is not allowed in this repository." >&2
exit 1
fi
;; ;;
refs/heads/*,commit) refs/heads/*,commit)
# branch # branch