git.samba.org
/
jelmer
/
dulwich.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ce4e3e5
)
[object_store] Avoid leaking previous pack when adding known pack
author
Earl Chew
<earl_chew@yahoo.com>
Sat, 26 Aug 2017 14:29:24 +0000
(07:29 -0700)
committer
Jelmer Vernooij
<jelmer@debian.org>
Sat, 26 Aug 2017 16:16:16 +0000
(16:16 +0000)
Signed-off-by: Earl Chew <earl_chew@yahoo.com>
dulwich/object_store.py
patch
|
blob
|
history
diff --git
a/dulwich/object_store.py
b/dulwich/object_store.py
index 59e9ead1a8ecac1184b8298fac3f83fccaef9204..9fb7b94bcf0194aff4efba457a0df98ec6e9839c 100644
(file)
--- a/
dulwich/object_store.py
+++ b/
dulwich/object_store.py
@@
-293,7
+293,11
@@
class PackBasedObjectStore(BaseObjectStore):
"""Add a newly appeared pack to the cache by path.
"""
- self._pack_cache[base_name] = pack
+ prev_pack = self._pack_cache.get(base_name)
+ if prev_pack is not pack:
+ self._pack_cache[base_name] = pack
+ if prev_pack:
+ prev_pack.close()
def _flush_pack_cache(self):
pack_cache = self._pack_cache