Explorar o código

Only override pack file if it doesn't yet exist.

Jelmer Vernooij %!s(int64=7) %!d(string=hai) anos
pai
achega
1f098d17a8
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      dulwich/object_store.py

+ 8 - 0
dulwich/object_store.py

@@ -679,6 +679,14 @@ class DiskObjectStore(PackBasedObjectStore):
             basename = self._get_pack_basepath(entries)
             with GitFile(basename+".idx", "wb") as f:
                 write_pack_index_v2(f, entries, p.get_stored_checksum())
+        if self._pack_cache is None or self._pack_cache_stale():
+            self._update_pack_cache()
+        try:
+            return self._pack_cache[basename]
+        except KeyError:
+            pass
+        else:
+            os.unlink(path)
         os.rename(path, basename + ".pack")
         final_pack = Pack(basename)
         self._add_known_pack(basename, final_pack)