git-prompt: add a describe style for any tags

git-prompt has various describe styles, among them "describe" (by
annotated tags) and "default" (by exact match with any tag).

Add a mode "tag" that describes by any tag, annotated or not.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Michael J Gruber 2017-03-15 14:15:09 +01:00 committed by Junio C Hamano
parent e7e07d5a4f
commit 9f0b4dd0b8

View file

@ -82,6 +82,7 @@
# contains relative to newer annotated tag (v1.6.3.2~35) # contains relative to newer annotated tag (v1.6.3.2~35)
# branch relative to newer tag or branch (master~4) # branch relative to newer tag or branch (master~4)
# describe relative to older annotated tag (v1.6.3.1-13-gdd42c2f) # describe relative to older annotated tag (v1.6.3.1-13-gdd42c2f)
# tag relative to any older tag (v1.6.3.1-13-gdd42c2f)
# default exactly matching tag # default exactly matching tag
# #
# If you would like a colored hint about the current dirty state, set # If you would like a colored hint about the current dirty state, set
@ -443,6 +444,8 @@ __git_ps1 ()
git describe --contains HEAD ;; git describe --contains HEAD ;;
(branch) (branch)
git describe --contains --all HEAD ;; git describe --contains --all HEAD ;;
(tag)
git describe --tags HEAD ;;
(describe) (describe)
git describe HEAD ;; git describe HEAD ;;
(* | default) (* | default)