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

Re: [PATCH] hooks--update: allow deleting a tag through git push <remote> :<tag>

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 8, 2007, 00:54 UTC
Message-ID
<7v640d8skt.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20071107103450.29849.qmail@c27a4ce40673ff.315fe32.mid.smarden.org>
Gerrit Pape <pape@smarden.org> writes:
Show 11 quoted lines
> The update hook interpretes deleting a tag, no matter if annotated or not,
> through git push <remote> :<tag> as unannotated tag, and declines it by
> default:
> ...
> With this patch deleting a tag is allowed unconditionally, just as
> deleting a branch.
>
> Signed-off-by: Gerrit Pape <pape@smarden.org>
> ---
>  templates/hooks--update |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)

Since you are allowing deletion for anything, wouldn't this be much simpler, I wonder...

---
 templates/hooks--update |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates/hooks--update b/templates/hooks--update
index d8c7626..e12904a 100644
--- a/templates/hooks--update
+++ b/templates/hooks--update
@@ -41,9 +41,9 @@ if [ -z "$projectdesc" -o "$projectdesc" = "Unnamed repository; edit this file t
 fi
 
 # --- Check types
-# if $newrev is 0000...0000, it's a commit to delete a branch
+# if $newrev is 0000...0000, it's a commit to delete a ref.
 if [ "$newrev" = "0000000000000000000000000000000000000000" ]; then
-	newrev_type=commit
+	exit 0 ;# allow anything to be deleted
 else
 	newrev_type=$(git-cat-file -t $newrev)
 fi
Previous: Gerrit PapeNext: Gerrit Pape
Message 2 of 3 in “hooks--update: allow deleting a tag through git push <remote> :<tag>”
  1. hooks--update: allow deleting a tag through git push <remote> :<tag>Gerrit Pape, Nov 7, 2007
  2. Junio C HamanoNov 8, 2007
  3. hooks--update: decline deleting tags or branches by default, add config optionsGerrit Pape, Nov 8, 2007

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.