]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/git.py
git: PackIdxList: close extra packs when refreshing
[bup.git] / lib / bup / git.py
index 3608f183715d4981f1dacb11adcd93a6c56817ae..73a50b88773f6585c01e264775cfe9a91c0bd120 100644 (file)
@@ -682,8 +682,13 @@ class PackIdxList:
                         continue
                     d[full] = ix
             bfull = os.path.join(self.dir, b'bup.bloom')
-            self.packs = list(set(d.values()))
-            self.packs.sort(reverse=True, key=lambda x: len(x))
+            new_packs = set(d.values())
+            for p in self.packs:
+                if not p in new_packs:
+                    p.close()
+            new_packs = list(new_packs)
+            new_packs.sort(reverse=True, key=lambda x: len(x))
+            self.packs = new_packs
             if self.bloom is None and os.path.exists(bfull):
                 self.bloom = bloom.ShaBloom(bfull)
             try: