mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-06 11:40:31 +00:00
fuse: slightly refactor shadowing detection
if it is not a directory, the old code was a NOP, so we can just check that first.
This commit is contained in:
parent
83c99943c3
commit
8b5372b54c
1 changed files with 12 additions and 14 deletions
|
@ -140,20 +140,18 @@ class FuseOperations(llfuse.Operations):
|
|||
for item in unpacker:
|
||||
item = Item(internal_dict=item)
|
||||
is_dir = stat.S_ISDIR(item.mode)
|
||||
try:
|
||||
# This can happen if an archive was created with a command line like
|
||||
# $ borg create ... dir1/file dir1
|
||||
# In this case the code below will have created a default_dir inode for dir1 already.
|
||||
path = safe_encode(item.path)
|
||||
if not is_dir:
|
||||
# not a directory -> no lookup needed
|
||||
raise KeyError
|
||||
inode = self._find_inode(path, prefix)
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
self.items[inode] = item
|
||||
continue
|
||||
if is_dir:
|
||||
try:
|
||||
# This can happen if an archive was created with a command line like
|
||||
# $ borg create ... dir1/file dir1
|
||||
# In this case the code below will have created a default_dir inode for dir1 already.
|
||||
path = safe_encode(item.path)
|
||||
inode = self._find_inode(path, prefix)
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
self.items[inode] = item
|
||||
continue
|
||||
segments = prefix + os.fsencode(os.path.normpath(item.path)).split(b'/')
|
||||
del item.path
|
||||
num_segments = len(segments)
|
||||
|
|
Loading…
Add table
Reference in a new issue