Skip to content

Commit

Permalink
git-tag: -l to list tags (usability).
Browse files Browse the repository at this point in the history
git-tag -l lists all tags, and git-tag -l <pattern> filters the
result with <pattern>.

Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
Junio C Hamano committed Feb 17, 2006
1 parent 8cb711c commit b867c7c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Documentation/git-tag.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ git-tag - Create a tag object signed with GPG

SYNOPSIS
--------
[verse]
'git-tag' [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <name> [<head>]
'git-tag' -l [<pattern>]

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.
Expand All @@ -32,6 +34,9 @@ GnuPG key for signing.

`-d <tag>` deletes the tag.

`-l <pattern>` lists tags that match the given pattern (or all
if no pattern is given).

OPTIONS
-------
-a::
Expand All @@ -49,6 +54,9 @@ OPTIONS
-d::
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>::
Use the given tag message (instead of prompting)

Expand Down
14 changes: 13 additions & 1 deletion git-tag.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# 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'
. git-sh-setup

Expand All @@ -10,6 +10,7 @@ signed=
force=
message=
username=
list=
while case "$#" in 0) break ;; esac
do
case "$1" in
Expand All @@ -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
Expand Down

0 comments on commit b867c7c

Please sign in to comment.