Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15
STALE3732d

[PATCH] fix sample update hook, disable overwriting of existing tags

From: Heiko Voigt <hidden>
Date: 2016-06-15 22:46:43
Subsystem: the rest · Maintainer: Linus Torvalds

Because no special rule for this existed it was allowed by default

Signed-off-by: Heiko Voigt <redacted>
---
 templates/hooks--update.sample |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/templates/hooks--update.sample b/templates/hooks--update.sample
index f8bf490..68da609 100755
--- a/templates/hooks--update.sample
+++ b/templates/hooks--update.sample
@@ -82,6 +82,12 @@ case "$refname","$newrev_type" in
 		;;
 	refs/tags/*,tag)
 		# annotated tag
+		if [ "$allowdeletetag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
+		then
+			echo "*** Tag '$refname' already exists." >&2
+			echo "*** Overwriting a tag is not allowed in this repository." >&2
+			exit 1
+		fi
 		;;
 	refs/heads/*,commit)
 		# branch
-- 
1.6.2.1.423.g442d
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help