Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Extend sample update hook, disable modifying of existing tags
author
Heiko Voigt
<hvoigt@hvoigt.net>
Fri, 8 May 2009 15:22:30 +0000
(17:22 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Sat, 9 May 2009 07:31:00 +0000
(
00:31
-0700)
Because no special rule for this existed it was allowed by default
Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
templates/hooks--update.sample
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
5a0e4a2
)
diff --git
a/templates/hooks--update.sample
b/templates/hooks--update.sample
index f8bf490cffa2d41d19ffc9a31839ca3c2686df16..fd63b2d662dbcf98ec622a1ab754d041a559e3be 100755
(executable)
--- a/
templates/hooks--update.sample
+++ b/
templates/hooks--update.sample
@@
-13,6
+13,9
@@
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# 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
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
@@
-44,6
+47,7
@@
allowunannotated=$(git config --bool hooks.allowunannotated)
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
denycreatebranch=$(git config --bool hooks.denycreatebranch)
allowdeletetag=$(git config --bool hooks.allowdeletetag)
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
denycreatebranch=$(git config --bool hooks.denycreatebranch)
allowdeletetag=$(git config --bool hooks.allowdeletetag)
+allowmodifytag=$(git config --bool hooks.allowmodifytag)
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
@@
-82,6
+86,12
@@
case "$refname","$newrev_type" in
;;
refs/tags/*,tag)
# annotated tag
;;
refs/tags/*,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)
# branch
;;
refs/heads/*,commit)
# branch