Code

Use git-update-ref to delete a tag instead of rm()ing the ref file.
authorChristian Couder <chriscool@tuxfamily.org>
Sun, 1 Oct 2006 20:16:22 +0000 (22:16 +0200)
committerJunio C Hamano <junkio@cox.net>
Sun, 1 Oct 2006 22:17:43 +0000 (15:17 -0700)
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-tag.sh

index 2bde3c05fc1def12c68954bbc79e0879555bfe92..6463b314c6fe19c997c2a38d8dfdc1e9bb6637cb 100755 (executable)
@@ -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 $?
        ;;
     -*)