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

[PATCH] Use git-update-ref to delete a tag instead of rm()ing the ref file.

From
Christian Couder <chriscool@tuxfamily.org>
Date
Oct 1, 2006, 20:16 UTC
Message-ID
<20061001221622.0f68b471.chriscool@tuxfamily.org>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 git-tag.sh |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/git-tag.sh b/git-tag.sh
index 2bde3c0..6463b31 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -47,8 +47,10 @@ do
     -d)
     	shift
 	tag_name="$1"
-	rm "$GIT_DIR/refs/tags/$tag_name" && \
-	        echo "Deleted tag $tag_name."
+	tag=$(git-show-ref --verify --hash -- "refs/tags/$tag_name") ||
+		die "Seriously, what tag are you talking about?"
+	git-update-ref -m 'tag: delete' -d "refs/tags/$tag_name" "$tag" &&
+		echo "Deleted tag $tag_name."
 	exit $?
 	;;
     -*)
-- 
1.4.2.1.g8a7b-dirty
Message 1 of 1 in “Use git-update-ref to delete a tag instead of rm()ing the ref file.”
  1. Use git-update-ref to delete a tag instead of rm()ing the ref file.Christian Couder, Oct 1, 2006

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.