Web lists-archives.com

Re: [PATCH 2/3] git-prompt: add a describe style for any tags




Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx> writes:

> 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@xxxxxxxxxxxxxxxxxxxx>
> ---
>  contrib/completion/git-prompt.sh | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
> index 97eacd7832..c6cbef38c2 100644
> --- a/contrib/completion/git-prompt.sh
> +++ b/contrib/completion/git-prompt.sh
> @@ -82,6 +82,7 @@
>  #     contains      relative to newer annotated tag (v1.6.3.2~35)
>  #     branch        relative to newer tag or branch (master~4)
>  #     describe      relative to older annotated tag (v1.6.3.1-13-gdd42c2f)
> +#     tag           relative to any older tag (v1.6.3.1-13-gdd42c2f)

I guess this feature makes sense.  

I just wish we had a well-known unannotated tag we can use for such
an example; using v1.6.3.1 that is annotated does not help to make
the distinctin between describe and tag stand out.  We want to
convey "both annotated one and unannotated one can be used".

I am wondering if it makes sense to do something like this instead:

#	tag 	similar to 'describe' but also allow unannotated tags

>  #     default       exactly matching tag
>  #
>  # If you would like a colored hint about the current dirty state, set
> @@ -443,6 +444,8 @@ __git_ps1 ()
>  					git describe --contains HEAD ;;
>  				(branch)
>  					git describe --contains --all HEAD ;;
> +				(tag)
> +					git describe --tags HEAD ;;
>  				(describe)
>  					git describe HEAD ;;
>  				(* | default)