Commit Diff


commit - 4c3333066c370989f34d96881f559e3eee03391d
commit + 0c2ef7d5d21625100807b4ee37bc74831e351a4b
blob - 60b4e974f34091a8c67b4b796003d97e06477f43
blob + 428803447392d484a82f9ad9b99c61a6f16fe741
--- swh/loader/git/loader.py
+++ swh/loader/git/loader.py
@@ -884,15 +884,16 @@ class GitLoader(BaseGitLoader):
                 commits[commit_hash] = tree_hash
                 for parent_hex in commit.parents:
                     t = have_traversed(traversed_objects, parent_hex)
-                    if t is None or t is True:
-                        continue
-                    if parent_hex in parents:
-                        continue
-                    if parent_hex not in self.pack:
+                    if t is None:
                         continue
-                    parents.append(parent_hex)
                     parent_hash = hashutil.bytehex_to_hash(parent_hex)
                     commit_edges.append((commit_hash, parent_hash))
+                    if (
+                        t is False
+                        and parent_hex not in parents
+                        and parent_hex in self.pack
+                    ):
+                        parents.append(parent_hex)
 
         logger.debug(f"Found {len(tags)} tags and {len(commits)} commits")