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

Re: describe fails on tagless branch

From
Junio C Hamano <junkio@cox.net>
Date
Feb 7, 2007, 09:58 UTC
Message-ID
<7vy7na8f2t.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<200702070922.57163.andyparkins@gmail.com>
Andy Parkins <andyparkins@gmail.com> writes:
Show 8 quoted lines
> On Wednesday 2007 February 07 02:14, Junio C Hamano wrote:
>
>> I do not think it a good idea to make "git-describe" itself do
>> the above, as the user of describe may want to fall back on
>> something other than "rev-parse --verify" after ||.
>
> Agreed - the "nearest tag" mode (--abbrev=0) would be broken in that it 
> git-describe would return a tag that doesn't exist.

"describe" is about giving a short name for public communication to a commit in terms of well known tags. If there is no tag, then it is natural to say that the commit is indescribable.

In the case of "git-describe --abbrev=0 $indescribable", it could return an empty string, since there is no nearest tag after all. But that would not apply to non --abbrev=0 case.

Really, people should not be afraid to script a few-liner. Who cares if "git describe HEAD" says "can't" in an interactive session? And if you are scripting, and if you want your script to say something usable even for indescribable commits, then you would want to have an easy way to tell if the commit is describable or not. Changing it not to fail like it currently does means the script needs to do something more than just check the return value from describe $? in order to fall back on whatever alternative behaviour it wants to implement.

It might not be a bad idea to give '-q' option to make it silent when it fails because the commit is indescribable.

Previous: Andy ParkinsNext: Andy Parkins
Message 7 of 10 in “describe fails on tagless branch”
  1. Han-Wen NienhuysFeb 7, 2007
  2. Jakub NarebskiFeb 7, 2007
  3. Han-Wen NienhuysFeb 7, 2007
  4. Junio C HamanoFeb 7, 2007
  5. Jakub NarebskiFeb 7, 2007
  6. Andy ParkinsFeb 7, 2007
  7. Junio C HamanoFeb 7, 2007
  8. Andy ParkinsFeb 7, 2007
  9. Jakub NarebskiFeb 7, 2007
  10. Junio C HamanoFeb 7, 2007

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.