From 453c1e857534f90b88367f96fc8ca1e7841f9400 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 20 Jan 2007 10:47:41 -0800 Subject: [PATCH] git-tag -d: allow deleting multiple tags at once. Signed-off-by: Junio C Hamano --- Documentation/git-tag.txt | 8 ++++---- git-tag.sh | 21 +++++++++++++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt index 8a71ab37df..13c7aefbf3 100644 --- a/Documentation/git-tag.txt +++ b/Documentation/git-tag.txt @@ -3,14 +3,14 @@ git-tag(1) NAME ---- -git-tag - Create or verify a tag object signed with GPG +git-tag - Create, list, delete or verify a tag object signed with GPG SYNOPSIS -------- [verse] -'git-tag' [-a | -s | -u ] [-f | -d | -v] [-m | -F ] - [] +'git-tag' [-a | -s | -u ] [-f | -v] [-m | -F ] [] +'git-tag' -d ... 'git-tag' -l [] DESCRIPTION @@ -55,7 +55,7 @@ OPTIONS Replace an existing tag with the given name (instead of failing) -d:: - Delete an existing tag with the given name + Delete existing tags with the given names. -v:: Verify the gpg signature of given the tag diff --git a/git-tag.sh b/git-tag.sh index ecb9100e4b..94499c9b36 100755 --- a/git-tag.sh +++ b/git-tag.sh @@ -63,12 +63,21 @@ do ;; -d) shift - tag_name="$1" - 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 $? + had_error=0 + for tag + do + cur=$(git-show-ref --verify --hash -- "refs/tags/$tag") || { + echo >&2 "Seriously, what tag are you talking about?" + had_error=1 + continue + } + git-update-ref -m 'tag: delete' -d "refs/tags/$tag" "$cur" || { + had_error=1 + continue + } + echo "Deleted tag $tag." + done + exit $had_error ;; -v) shift -- 2.11.4.GIT