From c02859987fc5142b6ccf459ed9bf8508ba718a12 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Wed, 29 Mar 2023 21:55:12 +0000 Subject: [PATCH] Skip temporary metadata dependency resolution if there are no dependencies --- codearchiver/modules/git.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/codearchiver/modules/git.py b/codearchiver/modules/git.py index a64d836..e0105c6 100644 --- a/codearchiver/modules/git.py +++ b/codearchiver/modules/git.py @@ -271,18 +271,20 @@ class Git(codearchiver.core.Module): # Bundling completed without issues; wait for depended-on bundles, add them to the metadata, then replace own temporary metadata if self._storage: - self._storage.wait_temporary_metadata(tmpMetadataDependencies) + if tmpMetadataDependencies: + self._storage.wait_temporary_metadata(tmpMetadataDependencies) with self._storage.lock(): - criteria = [('Module', type(self).name), ('Root commit', tuple(rootCommits)), ('Object', tuple(baseInProgressObjects))] - missingObjects = baseInProgressObjects.copy() - for oldBundleName, oldObjects, oldOids in self._find_storage_bundles(criteria, {value.split(' ', 1)[0] for value in baseInProgressObjects}): - metadata.append('Based on bundle', oldBundleName) - baseOids |= oldOids - missingObjects -= oldObjects - - # Verification: all commit/tag objects collected from temporary metadata must be covered - if missingObjects: - raise RuntimeError('Resolved temporary metadata bundles do not cover all expected objects') + if tmpMetadataDependencies: + criteria = [('Module', type(self).name), ('Root commit', tuple(rootCommits)), ('Object', tuple(baseInProgressObjects))] + missingObjects = baseInProgressObjects.copy() + for oldBundleName, oldObjects, oldOids in self._find_storage_bundles(criteria, {value.split(' ', 1)[0] for value in baseInProgressObjects}): + metadata.append('Based on bundle', oldBundleName) + baseOids |= oldOids + missingObjects -= oldObjects + + # Verification: all commit/tag objects collected from temporary metadata must be covered + if missingObjects: + raise RuntimeError('Resolved temporary metadata bundles do not cover all expected objects') # Verification: all objects in the clone are either in a base bundle or in the index # This can only be done here because all oids are needed, not just the commit/tag objects