git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
May 7, 2009, 16:40 UTC
Message-ID
<20090507164023.GB5807@macbook.lan>
Because no special rule for this existed it was allowed by default
Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
---
 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
Next: Junio C Hamano
Message 1 of 3 in “fix sample update hook, disable overwriting of existing tags”
  1. fix sample update hook, disable overwriting of existing tagsHeiko Voigt, May 7, 2009
  2. Junio C HamanoMay 8, 2009
  3. Extend sample update hook, disable modifying of existing tagsHeiko Voigt, May 8, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.