Skip to content

Extractor multiple tags

The Extractor classes in surgeon/extractor.go currently have issues with commits that have multiple tags. The first issue is with the HgExtractor class parsing such commits in Mercurial repos. That's fairly straightforwardly fixed by the first patch.

That brings the Git and Hg extractors up to parity and brings us to the second issue. Consider a Git repo with the following two commits:

* b197b05 (HEAD -> master) morestuff
* c442e2f (tag: tag2, tag: tag1) add file

This produces a git fast export as follows (filtering blobs and the contents of commits):

reset refs/tags/tag1
commit refs/tags/tag1
mark :2

commit refs/heads/master
mark :4
from :2

reset refs/heads/master
from :4

reset refs/tags/tag2
from :2

The broken code produces this (Note tag2 is missing):

reset refs/tags/tag1
commit refs/tags/tag1
mark :2

commit refs/heads/master
mark :4
from :2

reset refs/heads/master
from :4

The patched code produces this:

commit refs/tags/tag1
mark :2

commit refs/heads/master
mark :4
from :2

reset refs/tags/tag1
from :2

reset refs/tags/tag2
from :2

reset refs/heads/master
from :4

There's two questions to ask here:

  1. Does it matter that in my patch the tag1 reset is not before the first commit like in the fast export?
  2. Will my code mess up something else deeper in the process that I'm not aware of?

I have tested my code as above, and on a larger production Mercurial repository I'm working on converting. The converted repo now shows the correct set of tags as compared with the original,

Merge request reports