Commit Diff


commit - 60aa31fc9deb166a04e11747a25d0f4966d3e42a
commit + 990e70e8bba83e9cb735aa621d7f08058ded32eb
blob - 1adf1246871406ca6e02b4d4623b4fc60c71fc0c
blob + 7238aa354bc75c7c76d30de51c6aa8257b766e42
--- swh/loader/git/loader.py
+++ swh/loader/git/loader.py
@@ -752,6 +752,7 @@ class GitLoader(BaseGitLoader):
         # Populate the graph with trees and blobs
         new_vertices = []
         new_edges = []
+        traversed_trees = set()
         for commit_hash, tree_hash in commits.items():
             logger.debug(
                 f"commit {hashutil.hash_to_hex(commit_hash)} "
@@ -760,6 +761,9 @@ class GitLoader(BaseGitLoader):
             subtrees = [tree_hash]
             while len(subtrees) > 0:
                 tree_hash = subtrees.pop(0)
+                if tree_hash in traversed_trees:
+                    continue
+                traversed_trees.add(tree_hash)
                 tree_hex = hashutil.hash_to_bytehex(tree_hash)
                 try:
                     tree = self.pack[tree_hex]