Explorar el Código

Fix another race condition in pack handling.

Jelmer Vernooij hace 6 años
padre
commit
8f0ed17844
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      dulwich/object_store.py

+ 4 - 1
dulwich/object_store.py

@@ -405,7 +405,6 @@ class PackBasedObjectStore(BaseObjectStore):
         old_packs = {p.name(): p for p in self.packs}
         for name, pack in old_packs.items():
             objects.update((obj, None) for obj in pack.iterobjects())
-        self._clear_cached_packs()
 
         # The name of the consolidated pack might match the name of a
         # pre-existing pack. Take care not to remove the newly created
@@ -618,6 +617,10 @@ class DiskObjectStore(PackBasedObjectStore):
     def _remove_pack(self, pack):
         os.remove(pack.data.path)
         os.remove(pack.index.path)
+        try:
+            del self._pack_cache[os.path.basename(pack._basename)]
+        except KeyError:
+            pass
 
     def _get_pack_basepath(self, entries):
         suffix = iter_sha1(entry[0] for entry in entries)