Web lists-archives.com

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




Junio C Hamano venit, vidit, dixit 15.03.2017 20:25:
> 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

or inventing a local lightweight tag such as "lastgood-5-gbadbad").
Either way would be fine with me. (I guess it's in next as is now.)

>>  #     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)