@matheusbsbs / matheus-bagliano / commits / b867c7c23a
Fork 0

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>

Junio C Hamano committed Feb 17, 2006 at 04:04 UTC b867c7c23a42fbe9f261153a9814a5efbc071a29
2 files changed +22 -2
Documentation/git-tag.txt
+9 -1
@@ -8,11 +8,13 @@ git-tag - Create a tag object signed with GPG
8
9 SYNOPSIS
10 --------
11 +[verse]
12 'git-tag' [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <name> [<head>]
13 +'git-tag' -l [<pattern>]
14
15 DESCRIPTION
16 -----------
15 -Adds a 'tag' reference in .git/refs/tags/
17 +Adds a 'tag' reference in `.git/refs/tags/`
18
19 Unless `-f` is given, the tag must not yet exist in
20 `.git/refs/tags/` directory.
@@ -32,6 +34,9 @@ GnuPG key for signing.
34
35 `-d <tag>` deletes the tag.
36
37 +`-l <pattern>` lists tags that match the given pattern (or all
38 +if no pattern is given).
39 +
40 OPTIONS
41 -------
42 -a::
@@ -49,6 +54,9 @@ OPTIONS
54 -d::
55 Delete an existing tag with the given name
56
57 +-l <pattern>::
58 + List tags that match the given pattern (or all if no pattern is given).
59 +
60 -m <msg>::
61 Use the given tag message (instead of prompting)
62
git-tag.sh
+13 -1
@@ -1,7 +1,7 @@
1 #!/bin/sh
2 # Copyright (c) 2005 Linus Torvalds
3
4 -USAGE='[-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <tagname> [<head>]'
4 +USAGE='-l [<pattern>] | [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <tagname> [<head>]'
5 SUBDIRECTORY_OK='Yes'
6 . git-sh-setup
7
@@ -10,6 +10,7 @@ signed=
10 force=
11 message=
12 username=
13 +list=
14 while case "$#" in 0) break ;; esac
15 do
16 case "$1" in
@@ -23,6 +24,17 @@ do
24 -f)
25 force=1
26 ;;
27 + -l)
28 + cd "$GIT_DIR/refs" &&
29 + case "$#" in
30 + 1)
31 + find tags -type f -print ;;
32 + *)
33 + shift
34 + find tags -type f -print | grep "$@" ;;
35 + esac
36 + exit $?
37 + ;;
38 -m)
39 annotate=1
40 shift