filter-repo: avoid pruning annotated tags that we have seen

The former logic for keeping track of whether we had seen annotated tags
(and thus whether they were interesting and should avoid being pruned)
was just plain buggy.  I do not know if it was that bad from the start
or there was other surrounding code that made it different that got lost
in one of my history rewrites, but fix it.  I'll include tests of it
with --subdirectory-filter shortly.

Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
Elijah Newren 2019-03-07 22:45:59 -08:00
parent 5735fe6550
commit 1f0e57bada

View File

@ -1521,18 +1521,17 @@ class FastExportFilter(object):
if self._everything_callback:
self._everything_callback('tag', tag)
# The tag might not point at anything that still exists ( self.from_ref
# The tag might not point at anything that still exists (self.from_ref
# will be None if the commit it pointed to and all its ancestors were
# pruned due to being empty)
if not tag.from_ref:
# If everything in the history of this tag was pruned, we need to delete
# the fact that it was seen so that refs_to_nuke will include it and
# wipe out the original version of that tag.
if tag.from_ref:
# Print out this tag's information
if not tag.dumped:
tag.dump(self._output)
# Record the fact that this tag was seen so we don't nuke it as part
# of refs_to_nuke.
full_ref = 'refs/tags/{}'.format(tag.ref)
if full_ref in self._seen_refs:
del self._seen_refs[full_ref]
elif not tag.dumped:
tag.dump(self._output)
self._seen_refs[full_ref] = None
def _parse_progress(self):
"""