threads / patch / 5780

patchUse git-update-ref to delete a tag instead of rm()ing the ref file.

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

## tl;dr

One message between Oct 1, 2006 and Oct 1, 2006. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Christian Couder· Oct 1, 2006, 20:16 UTC · lore
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 git-tag.sh |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Show changes to git-tag.sh +4 −2
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

← back to recent threads