mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-14 16:11:43 +00:00
extract: fix incorrect progress output for hard links
this produces correct output if any (non proper) subset of hardlinks are extracted.
This commit is contained in:
parent
b845a074cb
commit
b5d7f1df26
2 changed files with 7 additions and 4 deletions
|
@ -459,7 +459,7 @@ class Archiver:
|
|||
if progress:
|
||||
progress_logger = logging.getLogger(ProgressIndicatorPercent.LOGGER)
|
||||
progress_logger.info('Calculating size')
|
||||
extracted_size = sum(item.file_size() for item in archive.iter_items(filter))
|
||||
extracted_size = sum(item.file_size(hardlink_masters) for item in archive.iter_items(filter))
|
||||
pi = ProgressIndicatorPercent(total=extracted_size, msg='Extracting files %5.1f%%', step=0.1)
|
||||
else:
|
||||
pi = None
|
||||
|
|
|
@ -157,10 +157,13 @@ class Item(PropDict):
|
|||
|
||||
part = PropDict._make_property('part', int)
|
||||
|
||||
def file_size(self):
|
||||
if 'chunks' not in self:
|
||||
def file_size(self, hardlink_masters=None):
|
||||
hardlink_masters = hardlink_masters or {}
|
||||
chunks, _ = hardlink_masters.get(self.get('source'), (None, None))
|
||||
chunks = self.get('chunks', chunks)
|
||||
if chunks is None:
|
||||
return 0
|
||||
return sum(chunk.size for chunk in self.chunks)
|
||||
return sum(chunk.size for chunk in chunks)
|
||||
|
||||
|
||||
class EncryptedKey(PropDict):
|
||||
|
|
Loading…
Add table
Reference in a new issue