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

Re: git-tag bug? confusing git fast-export with double tag objects

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
May 14, 2009, 19:01 UTC
Message-ID
<qIGyi7O683pM7kzjmlY6QeiakFbPlBEHw9e9bG_SQhtXpvaqdek-Bw@cipher.nrlssc.navy.mil>
In-Reply-To
<op.utxlqej91e62zd@balu>
Matthias Andree wrote:
Show 20 quoted lines
> Am 14.05.2009, 15:42 Uhr, schrieb Sverre Rabbelier <srabbelier@gmail.com>:
> 
>> Heya,
>>
>> On Thu, May 14, 2009 at 15:39, Matthias Andree
>> <matthias.andree@gmx.de> wrote:
>>> The bug itself (references to 'deleted' or 'replaced' tag objects remain
>>> reachable rather than becoming dangling) is still there without a
>>> suggestion
>>> to the solution, and you're uselessly the bug.
>>
>> I believe Alex is saying that this is not a bug, but intended
>> behavior, and Matthias is saying that we should change that behavior
>> so that users are at least aware that they are creating such a
>> situation, is that correct?
> 
> I think my statements are:
> 
> 1- git tag -d and git tag -f do not work as advertised for tag objects (as
> opposed to lightweight tags); evidence in the longish mail
Both of these do indeed work.

In your examples 'git tag -d' worked as intended. The tag was deleted even though the object still remained in the object database. The tag subcommand does not remove objects. Objects which are not used anymore are removed by running the 'git gc' command. This happens automatically periodically. If you want to see them disappear now, run 'git gc --prune=now'.

In your examples, 'git tag -f' worked as intended. The "object" referenced by the command line arguments was tagged, and the existing tag was replaced by a new tag with the same name.

So when you do
  $ git tag -f -m 'add tag foo' foo foo

the second foo is dereferenced, and it's object id is what is tagged. So it is equivalent to the following:

  $ git tag -f -m 'add tag foo' foo 2e326d8a210536b7cd1f2bc77e3e29d7231f9ec4
This object happens to be a tag object which points to a commit.
Your graph:
  objects:  4481a1 (commit) <- 2e326d (tag "foo") <- 72f346 (tag "foo")

is perfectly correct and valid. The middle tag object does not exist in the tag namespace though. Its name is embedded in the tag object and is necessary for validating the tag object.

Show 7 quoted lines
> 2- I presume that the bug cannot be really fixed (signed tags created by
> somebody else), we then have several solutions:
>  2a- warn the user and refuse
>  2b- warn the user and continue nonetheless
>  2c- warn the user and add options to force the user should at least be
> warned that he may be doing something which doesn't work as intended, or
>  2d- give the user a possibility to force git to do stupid things.

There are no 'cycles', there is no inconsistency, there is no bug, except perhaps in git fast-export.

-brandon
Previous: Matthias AndreeNext: Jeff King
Message 12 of 30 in “git-tag bug? confusing git fast-export with double tag objects”
  1. Matthias AndreeMay 14, 2009
  2. Matthias AndreeMay 14, 2009
  3. Junio C HamanoMay 14, 2009
  4. Matthias AndreeMay 14, 2009
  5. Michael J GruberMay 14, 2009
  6. Alex RiesenMay 14, 2009
  7. Matthias AndreeMay 14, 2009
  8. Alex RiesenMay 14, 2009
  9. Matthias AndreeMay 14, 2009
  10. Sverre RabbelierMay 14, 2009
  11. Matthias AndreeMay 14, 2009
  12. Brandon CaseyMay 14, 2009
  13. Jeff KingMay 14, 2009
  14. Matthias AndreeMay 14, 2009
  15. Jeff KingMay 15, 2009
  16. Matthias AndreeMay 15, 2009
  17. Jakub NarebskiMay 15, 2009
  18. Johannes SixtMay 15, 2009
  19. Alex RiesenMay 15, 2009
  20. Matthias AndreeMay 15, 2009
  21. Andreas EricssonMay 15, 2009
  22. Junio C HamanoMay 15, 2009
  23. Andreas EricssonMay 16, 2009
  24. Jakub NarebskiMay 16, 2009
  25. Andreas EricssonMay 16, 2009
  26. Junio C HamanoMay 16, 2009
  27. Matthias AndreeMay 19, 2009
  28. Jeff KingMay 19, 2009
  29. Jeff KingMay 16, 2009
  30. Daniel ChengMay 15, 2009

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.