mirror of
https://github.com/git/git.git
synced 2024-11-20 18:05:51 +01:00
Merge branch 'mm/tag'
* mm/tag: Teach git-tag about showing tag annotations.
This commit is contained in:
commit
6abd0fb396
@ -11,7 +11,7 @@ SYNOPSIS
|
|||||||
[verse]
|
[verse]
|
||||||
'git-tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] <name> [<head>]
|
'git-tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] <name> [<head>]
|
||||||
'git-tag' -d <name>...
|
'git-tag' -d <name>...
|
||||||
'git-tag' -l [<pattern>]
|
'git-tag' [-n [<num>]] -l [<pattern>]
|
||||||
'git-tag' -v <name>
|
'git-tag' -v <name>
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
@ -38,8 +38,8 @@ GnuPG key for signing.
|
|||||||
|
|
||||||
`-v <tag>` verifies the gpg signature of the tag.
|
`-v <tag>` verifies the gpg signature of the tag.
|
||||||
|
|
||||||
`-l <pattern>` lists tags that match the given pattern (or all
|
`-l <pattern>` lists tags with names that match the given pattern
|
||||||
if no pattern is given).
|
(or all if no pattern is given).
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-------
|
-------
|
||||||
@ -61,8 +61,13 @@ OPTIONS
|
|||||||
-v::
|
-v::
|
||||||
Verify the gpg signature of given the tag
|
Verify the gpg signature of given the tag
|
||||||
|
|
||||||
|
-n <num>::
|
||||||
|
<num> specifies how many lines from the annotation, if any,
|
||||||
|
are printed when using -l.
|
||||||
|
The default is not to print any annotation lines.
|
||||||
|
|
||||||
-l <pattern>::
|
-l <pattern>::
|
||||||
List tags that match the given pattern (or all if no pattern is given).
|
List tags with names 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)
|
||||||
|
44
git-tag.sh
44
git-tag.sh
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (c) 2005 Linus Torvalds
|
# Copyright (c) 2005 Linus Torvalds
|
||||||
|
|
||||||
USAGE='-l [<pattern>] | [-a | -s | -u <key-id>] [-f | -d | -v] [-m <msg>] <tagname> [<head>]'
|
USAGE='[-n [<num>]] -l [<pattern>] | [-a | -s | -u <key-id>] [-f | -d | -v] [-m <msg>] <tagname> [<head>]'
|
||||||
SUBDIRECTORY_OK='Yes'
|
SUBDIRECTORY_OK='Yes'
|
||||||
. git-sh-setup
|
. git-sh-setup
|
||||||
|
|
||||||
@ -13,6 +13,7 @@ message=
|
|||||||
username=
|
username=
|
||||||
list=
|
list=
|
||||||
verify=
|
verify=
|
||||||
|
LINES=0
|
||||||
while case "$#" in 0) break ;; esac
|
while case "$#" in 0) break ;; esac
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -26,14 +27,41 @@ do
|
|||||||
-f)
|
-f)
|
||||||
force=1
|
force=1
|
||||||
;;
|
;;
|
||||||
-l)
|
-n)
|
||||||
case "$#" in
|
case $2 in
|
||||||
1)
|
-*) LINES=1 # no argument
|
||||||
set x . ;;
|
;;
|
||||||
|
*) shift
|
||||||
|
LINES=$(expr "$1" : '\([0-9]*\)')
|
||||||
|
[ -z "$LINES" ] && LINES=1 # 1 line is default when -n is used
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
;;
|
||||||
|
-l)
|
||||||
|
list=1
|
||||||
shift
|
shift
|
||||||
git rev-parse --symbolic --tags | sort | grep "$@"
|
PATTERN="$1" # select tags by shell pattern, not re
|
||||||
exit $?
|
git rev-parse --symbolic --tags | sort |
|
||||||
|
while read TAG
|
||||||
|
do
|
||||||
|
case "$TAG" in
|
||||||
|
*$PATTERN*) ;;
|
||||||
|
*) continue ;;
|
||||||
|
esac
|
||||||
|
[ "$LINES" -le 0 ] && { echo "$TAG"; continue ;}
|
||||||
|
OBJTYPE=$(git cat-file -t "$TAG")
|
||||||
|
case $OBJTYPE in
|
||||||
|
tag) ANNOTATION=$(git cat-file tag "$TAG" |
|
||||||
|
sed -e '1,/^$/d' \
|
||||||
|
-e '/^-----BEGIN PGP SIGNATURE-----$/Q' )
|
||||||
|
printf "%-15s %s\n" "$TAG" "$ANNOTATION" |
|
||||||
|
sed -e '2,$s/^/ /' \
|
||||||
|
-e "${LINES}q"
|
||||||
|
;;
|
||||||
|
*) echo "$TAG"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
;;
|
;;
|
||||||
-m)
|
-m)
|
||||||
annotate=1
|
annotate=1
|
||||||
@ -97,6 +125,8 @@ do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
[ -n "$list" ] && exit 0
|
||||||
|
|
||||||
name="$1"
|
name="$1"
|
||||||
[ "$name" ] || usage
|
[ "$name" ] || usage
|
||||||
prev=0000000000000000000000000000000000000000
|
prev=0000000000000000000000000000000000000000
|
||||||
|
Loading…
Reference in New Issue
Block a user