mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-23 06:31:58 +00:00
use same finalizing code for hardlink masters and slaves
hardlink slaves get a precomputed size attribute now.
This commit is contained in:
parent
a206a85890
commit
e5d094d0ce
1 changed files with 3 additions and 6 deletions
|
@ -934,14 +934,11 @@ def process_file(self, path, st, cache, ignore_inode=False):
|
||||||
source = self.hard_links.get((st.st_ino, st.st_dev))
|
source = self.hard_links.get((st.st_ino, st.st_dev))
|
||||||
if source is not None:
|
if source is not None:
|
||||||
item.source = source
|
item.source = source
|
||||||
item.update(self.stat_attrs(st, path))
|
|
||||||
self.add_item(item)
|
|
||||||
status = 'h' # regular file, hardlink (to already seen inodes)
|
status = 'h' # regular file, hardlink (to already seen inodes)
|
||||||
return status
|
|
||||||
else:
|
else:
|
||||||
hardlink_master = True
|
hardlink_master = True
|
||||||
is_special_file = is_special(st.st_mode)
|
is_special_file = is_special(st.st_mode)
|
||||||
if True:
|
if not hardlinked or hardlink_master:
|
||||||
if not is_special_file:
|
if not is_special_file:
|
||||||
path_hash = self.key.id_hash(safe_encode(os.path.join(self.cwd, path)))
|
path_hash = self.key.id_hash(safe_encode(os.path.join(self.cwd, path)))
|
||||||
ids = cache.file_known_and_unchanged(path_hash, st, ignore_inode)
|
ids = cache.file_known_and_unchanged(path_hash, st, ignore_inode)
|
||||||
|
@ -979,15 +976,15 @@ def process_file(self, path, st, cache, ignore_inode=False):
|
||||||
# block or char device will change without its mtime/size/inode changing.
|
# block or char device will change without its mtime/size/inode changing.
|
||||||
cache.memorize_file(path_hash, st, [c.id for c in item.chunks])
|
cache.memorize_file(path_hash, st, [c.id for c in item.chunks])
|
||||||
status = status or 'M' # regular file, modified (if not 'A' already)
|
status = status or 'M' # regular file, modified (if not 'A' already)
|
||||||
|
self.stats.nfiles += 1
|
||||||
item.update(self.stat_attrs(st, path))
|
item.update(self.stat_attrs(st, path))
|
||||||
item.get_size(memorize=True)
|
item.get_size(memorize=True)
|
||||||
if is_special_file:
|
if is_special_file:
|
||||||
# we processed a special file like a regular file. reflect that in mode,
|
# we processed a special file like a regular file. reflect that in mode,
|
||||||
# so it can be extracted / accessed in FUSE mount like a regular file:
|
# so it can be extracted / accessed in FUSE mount like a regular file:
|
||||||
item.mode = stat.S_IFREG | stat.S_IMODE(item.mode)
|
item.mode = stat.S_IFREG | stat.S_IMODE(item.mode)
|
||||||
self.stats.nfiles += 1
|
|
||||||
self.add_item(item)
|
self.add_item(item)
|
||||||
if hardlinked and hardlink_master:
|
if hardlink_master:
|
||||||
# Add the hard link reference *after* the file has been added to the archive.
|
# Add the hard link reference *after* the file has been added to the archive.
|
||||||
self.hard_links[st.st_ino, st.st_dev] = safe_path
|
self.hard_links[st.st_ino, st.st_dev] = safe_path
|
||||||
return status
|
return status
|
||||||
|
|
Loading…
Reference in a new issue