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

git describe bug?

From
Dustin Sallings <dustin@spy.net>
Date
Apr 2, 2010, 17:20 UTC
Message-ID
<0B8BD2B7-E6F9-4EFC-BCD6-2B2E876AD1FC@spy.net>
	describe does not choose the most recent tag when multiple tags point to a single commit (for example, when an RC release becomes a proper release).
	There's a bit of conflict in the documentation between the following:
		``tags with newer dates will always be preferred over tags with older dates''
	and the next sentence:
		``If an exact match is found, its name will be output and searching will stop.''
	The code does not allow for multiple exact matches, leading to what I would consider incorrect behavior as shown below:

dhcp-103:/tmp/x 1212% git init Initialized empty Git repository in /private/tmp/x/.git/ dhcp-103:/tmp/x 1213% git config user.email me@example.com dhcp-103:/tmp/x 1214% git commit --allow-empty -m initial [master (root-commit) 7eb97db] initial dhcp-103:/tmp/x 1215% git commit --allow-empty -m second [master 86544e0] second dhcp-103:/tmp/x 1216% git tag -m first 1.0 dhcp-103:/tmp/x 1217% git describe # expect 1.0 1.0 dhcp-103:/tmp/x 1218% git tag -m second 2.0 dhcp-103:/tmp/x 1219% git describe # expect 2.0 1.0 dhcp-103:/tmp/x 1220% git show-ref 86544e0414d9d4bc0767eed1ffe36b655638fe81 refs/heads/master 2594a45768685b7fbf69cf2e2fca087cdf3cbfec refs/tags/1.0 175a0473faa32cacff0b42f165d39a9547025432 refs/tags/2.0 dhcp-103:/tmp/x 1221% git cat-file tag refs/tags/1.0 object 86544e0414d9d4bc0767eed1ffe36b655638fe81 type commit tag 1.0 tagger Dustin Sallings <me@example.com> 1270227996 -0700

first 0.000u 0.001s 0:00.00 0.0% 0+0k 0+0io 0pf+0w dhcp-103:/tmp/x 1222% git cat-file tag refs/tags/2.0 object 86544e0414d9d4bc0767eed1ffe36b655638fe81 type commit tag 2.0 tagger Dustin Sallings <me@example.com> 1270228008 -0700

second
-- 
Dustin Sallings
Next: Shawn O. Pearce
Message 1 of 17 in “git describe bug?”
  1. Dustin SallingsApr 2, 2010
  2. Shawn O. PearceApr 2, 2010
  3. Andreas EricssonApr 6, 2010
  4. Shawn O. PearceApr 11, 2010
  5. describe: Break annotated tag ties by tagger dateShawn O. Pearce, Apr 11, 2010
  6. Junio C HamanoApr 11, 2010
  7. Shawn O. PearceApr 11, 2010
  8. 1/5 tag.c: Correct indentationShawn O. Pearce, Apr 12, 2010
  9. 2/5 tag.h: Remove unused signature fieldShawn O. Pearce, Apr 12, 2010
  10. 3/5 tag.c: Refactor parse_tag_buffer to be saner to programShawn O. Pearce, Apr 12, 2010
  11. 4/5 tag.c: Parse tagger date (if present)Shawn O. Pearce, Apr 12, 2010
  12. 5/5 describe: Break annotated tag ties by tagger dateShawn O. Pearce, Apr 12, 2010
  13. Andreas EricssonApr 13, 2010
  14. Thomas RastApr 13, 2010
  15. Shawn O. PearceApr 13, 2010
  16. Junio C HamanoApr 13, 2010
  17. Shawn O. PearceApr 13, 2010

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.