]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/midx.py
Add probabilistic "bup gc", but require --unsafe
[bup.git] / lib / bup / midx.py
index 57a478759297228622e32f102976150fe27d7525..1bf946ce28ebb0a9f48c55b6c708644ca45dbd57 100644 (file)
@@ -1,6 +1,9 @@
-import mmap
+
+import git, glob, mmap, os, struct
+
 from bup import _helpers
-from bup.helpers import *
+from bup.helpers import log, mmap_read
+
 
 MIDX_VERSION = 4
 
@@ -118,3 +121,7 @@ class PackMidx:
         return int(self._fanget(self.entries-1))
 
 
+def clear_midxes(dir=None):
+    dir = dir or git.repo('objects/pack')
+    for midx in glob.glob(os.path.join(dir, '*.midx')):
+        os.unlink(midx)