File tree Expand file tree Collapse file tree 2 files changed +46
-11
lines changed Expand file tree Collapse file tree 2 files changed +46
-11
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ SYNOPSIS
11
11
[verse]
12
12
'git-tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] <name> [<head>]
13
13
'git-tag' -d <name>...
14
- 'git-tag' -l [<pattern>]
14
+ 'git-tag' [-n [<num>]] -l [<pattern>]
15
15
'git-tag' -v <name>
16
16
17
17
DESCRIPTION
@@ -38,8 +38,8 @@ GnuPG key for signing.
38
38
39
39
`-v <tag>` verifies the gpg signature of the tag.
40
40
41
- `-l <pattern>` lists tags that match the given pattern (or all
42
- if no pattern is given).
41
+ `-l <pattern>` lists tags with names that match the given pattern
42
+ (or all if no pattern is given).
43
43
44
44
OPTIONS
45
45
-------
@@ -61,8 +61,13 @@ OPTIONS
61
61
-v::
62
62
Verify the gpg signature of given the tag
63
63
64
+ -n <num>::
65
+ <num> specifies how many lines from the annotation, if any,
66
+ are printed when using -l.
67
+ The default is not to print any annotation lines.
68
+
64
69
-l <pattern>::
65
- List tags that match the given pattern (or all if no pattern is given).
70
+ List tags with names that match the given pattern (or all if no pattern is given).
66
71
67
72
-m <msg>::
68
73
Use the given tag message (instead of prompting)
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
# Copyright (c) 2005 Linus Torvalds
3
3
4
- USAGE=' -l [<pattern>] | [-a | -s | -u <key-id>] [-f | -d | -v] [-m <msg>] <tagname> [<head>]'
4
+ USAGE=' [-n [<num>]] -l [<pattern>] | [-a | -s | -u <key-id>] [-f | -d | -v] [-m <msg>] <tagname> [<head>]'
5
5
SUBDIRECTORY_OK=' Yes'
6
6
. git-sh-setup
7
7
@@ -13,6 +13,7 @@ message=
13
13
username=
14
14
list=
15
15
verify=
16
+ LINES=0
16
17
while case " $# " in 0) break ;; esac
17
18
do
18
19
case " $1 " in
26
27
-f)
27
28
force=1
28
29
;;
29
- -l)
30
- case " $# " in
31
- 1)
32
- set x . ;;
30
+ -n)
31
+ case $2 in
32
+ -* ) LINES=1 # no argument
33
+ ;;
34
+ * ) shift
35
+ LINES=$( expr " $1 " : ' \([0-9]*\)' )
36
+ [ -z " $LINES " ] && LINES=1 # 1 line is default when -n is used
37
+ ;;
33
38
esac
39
+ ;;
40
+ -l)
41
+ list=1
34
42
shift
35
- git rev-parse --symbolic --tags | sort | grep " $@ "
36
- exit $?
43
+ PATTERN=" $1 " # select tags by shell pattern, not re
44
+ git rev-parse --symbolic --tags | sort |
45
+ while read TAG
46
+ do
47
+ case " $TAG " in
48
+ * $PATTERN * ) ;;
49
+ * ) continue ;;
50
+ esac
51
+ [ " $LINES " -le 0 ] && { echo " $TAG " ; continue ; }
52
+ OBJTYPE=$( git cat-file -t " $TAG " )
53
+ case $OBJTYPE in
54
+ tag) ANNOTATION=$( git cat-file tag " $TAG " |
55
+ sed -e ' 1,/^$/d' \
56
+ -e ' /^-----BEGIN PGP SIGNATURE-----$/Q' )
57
+ printf " %-15s %s\n" " $TAG " " $ANNOTATION " |
58
+ sed -e ' 2,$s/^/ /' \
59
+ -e " ${LINES} q"
60
+ ;;
61
+ * ) echo " $TAG "
62
+ ;;
63
+ esac
64
+ done
37
65
;;
38
66
-m)
39
67
annotate=1
97
125
shift
98
126
done
99
127
128
+ [ -n " $list " ] && exit 0
129
+
100
130
name=" $1 "
101
131
[ " $name " ] || usage
102
132
prev=0000000000000000000000000000000000000000
You can’t perform that action at this time.
0 commit comments