git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 15, 2017, 19:25 UTC
Message-ID
<xmqqvarae3zy.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<8d8fcdb4134090328662bf6fa5dfdba6c73fb6a5.1489581340.git.git@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 19 quoted lines
> 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>
> ---
>  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
Show 12 quoted lines
>  #     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)
Previous: Michael J GruberNext: Michael J Gruber
Message 45 of 46 in “describe --contains sanity”
  1. 0/3 describe --contains sanityMichael J Gruber, Mar 15, 2017
  2. 3/3 name-rev: Allow lightweight tags and branch refsMichael J Gruber, Mar 15, 2017
  3. Junio C HamanoMar 15, 2017
  4. Junio C HamanoMar 15, 2017
  5. Junio C HamanoMar 15, 2017
  6. 0/2 Teach name-rev to pay more attention to lightweight tagsJunio C Hamano, Mar 15, 2017
  7. 2/2 name-rev: favor describing with tags and use committer date to tiebreakJunio C Hamano, Mar 15, 2017
  8. Lars SchneiderMar 17, 2017
  9. Junio C HamanoMar 17, 2017
  10. Junio C HamanoMar 17, 2017
  11. Lars SchneiderMar 17, 2017
  12. Junio C HamanoMar 17, 2017
  13. Junio C HamanoMar 17, 2017
  14. 2/3 name-rev: favor describing with tags and use committer date to tiebreakMichael J Gruber, Mar 29, 2017
  15. 0/3 name-rev sanityMichael J Gruber, Mar 29, 2017
  16. Junio C HamanoMar 29, 2017
  17. Junio C HamanoMar 29, 2017
  18. Michael J GruberMar 30, 2017
  19. Junio C HamanoMar 30, 2017
  20. 3/4 name-rev: provide debug outputMichael J Gruber, Mar 31, 2017
  21. Junio C HamanoMar 31, 2017
  22. Junio C HamanoMar 31, 2017
  23. Michael J GruberMar 31, 2017
  24. Junio C HamanoMar 31, 2017
  25. Junio C HamanoMar 31, 2017
  26. Michael J GruberApr 3, 2017
  27. Junio C HamanoApr 3, 2017
  28. Junio C HamanoMay 20, 2017
  29. Junio C HamanoMar 31, 2017
  30. 4/4 describe: pass --debug down to name-revMichael J Gruber, Mar 31, 2017
  31. 0/4 name-rev sanityMichael J Gruber, Mar 31, 2017
  32. 1/4 name-rev: refactor logic to see if a new candidate is a better nameMichael J Gruber, Mar 31, 2017
  33. 2/4 name-rev: favor describing with tags and use committer date to tiebreakMichael J Gruber, Mar 31, 2017
  34. 1/3 name-rev: refactor logic to see if a new candidate is a better nameMichael J Gruber, Mar 29, 2017
  35. 3/3 name-rev: provide debug outputMichael J Gruber, Mar 29, 2017
  36. Michael J GruberMar 17, 2017
  37. Junio C HamanoMar 17, 2017
  38. 1/2 name-rev: refactor logic to see if a new candidate is a better nameJunio C Hamano, Mar 15, 2017
  39. Stefan BellerMar 16, 2017
  40. Jacob KellerMar 16, 2017
  41. 1/3 describe: debug is incompatible with containsMichael J Gruber, Mar 15, 2017
  42. Junio C HamanoMar 15, 2017
  43. Michael J GruberMar 17, 2017
  44. 2/3 git-prompt: add a describe style for any tagsMichael J Gruber, Mar 15, 2017
  45. Junio C HamanoMar 15, 2017
  46. Michael J GruberMar 17, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.