浏览代码

Close pack before attempting to remove it.

This is necessary on Windows.
Jelmer Vernooij 6 年之前
父节点
当前提交
9b25b13d53
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      dulwich/object_store.py

+ 3 - 2
dulwich/object_store.py

@@ -615,12 +615,13 @@ class DiskObjectStore(PackBasedObjectStore):
         os.remove(self._get_shafile_path(sha))
 
     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
+        pack.close()
+        os.remove(pack.data.path)
+        os.remove(pack.index.path)
 
     def _get_pack_basepath(self, entries):
         suffix = iter_sha1(entry[0] for entry in entries)