tag_item was not reading through repo.cat iterator after grabbing the
item type, leaving an in-progress read when listing tags after a
cached access to the commit referred by the tag. This manifests as an
AssertionError on `bup ls branch .tag` or similar vfs-consuming
command, or the bup fuse fs becoming almost completely unusable after
this access pattern as it errors EINVAL upon any attempt to read new
data from the repo! Resolve this by checking the cache up-front
before we do any reading.
Signed-off-by: Muh Muhten <muh.muhten@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
def tag_item(oid):
assert len(oid) == 20
+ cached = cache_get_commit_item(oid, need_meta=False)
+ if cached:
+ return cached
oidx = hexlify(oid)
it = repo.cat(oidx)
_, typ, size = next(it)
if typ == b'commit':
- return cache_get_commit_item(oid, need_meta=False) \
- or _commit_item_from_data(oid, b''.join(it))
+ return _commit_item_from_data(oid, b''.join(it))
for _ in it: pass
if typ == b'blob':
return Item(meta=default_file_mode, oid=oid)