(type, content) = git._decode_packobj(buf)
sha = git.calc_hash(type, content)
oldpack = w.exists(sha)
+ if oldpack and (oldpack == True or oldpack.endswith('.midx')):
+ # FIXME: we shouldn't really have to know about midx files
+ # at this layer. But exists() on a midx doesn't return the
+ # packname (since it doesn't know)... probably we should just
+ # fix that deficiency of midx files eventually, although it'll
+ # make the files bigger. This method is certainly not very
+ # efficient.
+ w.objcache.refresh(skip_midx = True, forget_packs = True)
+ oldpack = w.objcache.exists(sha)
+ log('new suggestion: %r\n' % oldpack)
+ assert(oldpack)
+ assert(oldpack != True)
+ assert(not oldpack.endswith('.midx'))
+ w.objcache.refresh(skip_midx = False)
if oldpack:
assert(oldpack.endswith('.idx'))
(dir,name) = os.path.split(oldpack)
return p.name
return None
- def refresh(self):
- global ignore_midx
+ def refresh(self, skip_midx = False, forget_packs = False):
+ if forget_packs:
+ self.packs = []
+ skip_midx = skip_midx or ignore_midx
d = dict([(p.name, 1) for p in self.packs])
if os.path.exists(self.dir):
- if not ignore_midx:
+ if not skip_midx:
midxl = []
for f in os.listdir(self.dir):
full = os.path.join(self.dir, f)