From: Junio C Hamano Date: Fri, 17 Feb 2006 12:04:39 +0000 (-0800) Subject: git-tag: -l to list tags (usability). X-Git-Tag: v1.3.0-rc1~201 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=b867c7c23a42fbe9f261153a9814a5efbc071a29;p=git.git git-tag: -l to list tags (usability). git-tag -l lists all tags, and git-tag -l filters the result with . Signed-off-by: Junio C Hamano --- diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt index e8892bb0..e1c76c60 100644 --- a/Documentation/git-tag.txt +++ b/Documentation/git-tag.txt @@ -8,11 +8,13 @@ git-tag - Create a tag object signed with GPG SYNOPSIS -------- +[verse] 'git-tag' [-a | -s | -u ] [-f | -d] [-m ] [] +'git-tag' -l [] DESCRIPTION ----------- -Adds a 'tag' reference in .git/refs/tags/ +Adds a 'tag' reference in `.git/refs/tags/` Unless `-f` is given, the tag must not yet exist in `.git/refs/tags/` directory. @@ -32,6 +34,9 @@ GnuPG key for signing. `-d ` deletes the tag. +`-l ` lists tags that match the given pattern (or all +if no pattern is given). + OPTIONS ------- -a:: @@ -49,6 +54,9 @@ OPTIONS -d:: Delete an existing tag with the given name +-l :: + List tags that match the given pattern (or all if no pattern is given). + -m :: Use the given tag message (instead of prompting) diff --git a/git-tag.sh b/git-tag.sh index c74e1b41..76e51ed1 100755 --- a/git-tag.sh +++ b/git-tag.sh @@ -1,7 +1,7 @@ #!/bin/sh # Copyright (c) 2005 Linus Torvalds -USAGE='[-a | -s | -u ] [-f | -d] [-m ] []' +USAGE='-l [] | [-a | -s | -u ] [-f | -d] [-m ] []' SUBDIRECTORY_OK='Yes' . git-sh-setup @@ -10,6 +10,7 @@ signed= force= message= username= +list= while case "$#" in 0) break ;; esac do case "$1" in @@ -23,6 +24,17 @@ do -f) force=1 ;; + -l) + cd "$GIT_DIR/refs" && + case "$#" in + 1) + find tags -type f -print ;; + *) + shift + find tags -type f -print | grep "$@" ;; + esac + exit $? + ;; -m) annotate=1 shift