Add an extra check in garbage collection to ensure we don't delete manifests referenced by other new-style tags
This commit is contained in:
parent
d0e1f464ff
commit
5b089653d1
1 changed files with 9 additions and 0 deletions
|
@ -438,6 +438,15 @@ def _delete_tags(repo, query_modifier=None):
|
|||
still_referenced_manifests = set([tmt.manifest_id for tmt in ref_query])
|
||||
manifest_ids_to_delete = list(manifest_ids_to_delete - still_referenced_manifests)
|
||||
|
||||
# Filter out any manifests referenced by other tags.
|
||||
if manifest_ids_to_delete:
|
||||
ref_query = (Tag
|
||||
.select()
|
||||
.where(Tag.manifest << manifest_ids_to_delete))
|
||||
|
||||
still_referenced_manifests = set([t.manifest_id for t in ref_query])
|
||||
manifest_ids_to_delete = list(set(manifest_ids_to_delete) - still_referenced_manifests)
|
||||
|
||||
num_deleted_manifests = 0
|
||||
if len(tag_manifest_ids_to_delete) > 0:
|
||||
# Find the set of IDs for all the labels to delete.
|
||||
|
|
Reference in a new issue