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