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

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

From
MAMatthias Andree <matthias.andree@gmx.de>
Date
May 14, 2009, 00:53 UTC
Message-ID
<op.utv93sdo1e62zd@merlin.emma.line.org>
Greetings,

I found a way to break git fast-export accidentally. I'm looking at the master branch, currently v1.6.3.1-9-g95405ba for me.

The short story is, I tried to regenerate signed tag objects after doctoring the history in a repo to fix b0rked addresses after conversion, doing something like:

	git tag -f -s foo foo
when I should have done
	git tag -f -s foo foo^{commit}

Now I have tag "foo" twice in my repo, and this screws some operations royally.

Here's a script to generate such a b0rked repo:

#! /bin/sh # # On your marks set -eu IFS=$(printf '\n\t') # # Set dir=$(mktemp -d) cd $dir git init echo foo >bar git add bar git commit -m "add bar" git tag -s baz -m "tag bar as baz" # # Go - this is correct, but we'll do wrong #git tag -f -s baz baz^{commit} -m "regenerate tag" # # This is wrong and confuses git fast-export: git tag -f -s baz baz -m "regenerate tag" # # Print the result git show baz

This is quite prominent in git fast-export --all --signed-tags=strip output:

...
tag baz
 from :2
tagger Matthias Andree <matthias.andree@gmx.de> 1242259705 +0200
data 15
tag bar as baz
tag baz
 from :0
tagger Matthias Andree <matthias.andree@gmx.de> 1242259705 +0200
data 11
regenerate

And the "from :0" hunk kills git fast-import afterwards as the mark :0 isn't defined. Not sure if it could cope with a duplicate tag otherwise. Probably not how git-tag should behave.

Questions:
1. how do I get a list of all such tags? git tag -l doesn't work. git  
rev-list --all is a bit unspecific for my taste, and not very helpful...
2. how do I trash the accidentally created 2nd "baz" tag object, i. e.  
remove it from the (packed) object database? Of course, I can hack some  
script (or use a text editor) to grind this git-fast-export into shape and  
re-importing it...
3. is this a shortcoming in git tag that doesn't properly resolve its 2nd  
non-option argument to a commit?
Thanks.
-- 
Matthias Andree
Next: Matthias Andree
Message 1 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.