git-tag: -l to list tags (usability).

git-tag -l lists all tags, and git-tag -l <pattern> filters the
result with <pattern>.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano 2006-02-17 04:04:39 -08:00
Родитель 8cb711c8a5
Коммит b867c7c23a
2 изменённых файлов: 22 добавлений и 2 удалений

Просмотреть файл

@ -8,11 +8,13 @@ git-tag - Create a tag object signed with GPG
SYNOPSIS SYNOPSIS
-------- --------
[verse]
'git-tag' [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <name> [<head>] 'git-tag' [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <name> [<head>]
'git-tag' -l [<pattern>]
DESCRIPTION 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 Unless `-f` is given, the tag must not yet exist in
`.git/refs/tags/` directory. `.git/refs/tags/` directory.
@ -32,6 +34,9 @@ GnuPG key for signing.
`-d <tag>` deletes the tag. `-d <tag>` deletes the tag.
`-l <pattern>` lists tags that match the given pattern (or all
if no pattern is given).
OPTIONS OPTIONS
------- -------
-a:: -a::
@ -49,6 +54,9 @@ OPTIONS
-d:: -d::
Delete an existing tag with the given name Delete an existing tag with the given name
-l <pattern>::
List tags that match the given pattern (or all if no pattern is given).
-m <msg>:: -m <msg>::
Use the given tag message (instead of prompting) Use the given tag message (instead of prompting)

Просмотреть файл

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# Copyright (c) 2005 Linus Torvalds # Copyright (c) 2005 Linus Torvalds
USAGE='[-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <tagname> [<head>]' USAGE='-l [<pattern>] | [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <tagname> [<head>]'
SUBDIRECTORY_OK='Yes' SUBDIRECTORY_OK='Yes'
. git-sh-setup . git-sh-setup
@ -10,6 +10,7 @@ signed=
force= force=
message= message=
username= username=
list=
while case "$#" in 0) break ;; esac while case "$#" in 0) break ;; esac
do do
case "$1" in case "$1" in
@ -23,6 +24,17 @@ do
-f) -f)
force=1 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) -m)
annotate=1 annotate=1
shift shift