if live_objects.exists(sha):
item_it = cat_pipe.get(sha.encode('hex'))
type = item_it.next()
- writer.write(sha, type, ''.join(item_it))
+ writer.just_write(sha, type, ''.join(item_it))
ns.stale_files.append(idx_name)
ns.stale_files.append(idx_name[:-3] + 'pack')
self._require_objcache()
return self.objcache.exists(id, want_source=want_source)
- def write(self, sha, type, content):
- """Write an object to the pack file. Fails if sha exists()."""
+ def just_write(self, sha, type, content):
+ """Write an object to the pack file, bypassing the objcache. Fails if
+ sha exists()."""
self._write(sha, type, content)
def maybe_write(self, type, content):
"""Write an object to the pack file if not present and return its id."""
sha = calc_hash(type, content)
if not self.exists(sha):
- self.write(sha, type, content)
+ self.just_write(sha, type, content)
self._require_objcache()
self.objcache.add(sha)
return sha