1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-03-03 18:27:01 +00:00

Merge pull request #7150 from ThomasWaldmann/fix-nfiles-1.2

Fix nfiles 1.2
This commit is contained in:
TW 2022-11-20 20:30:25 +01:00 committed by GitHub
commit d4cd911d46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 11 deletions

View file

@ -632,14 +632,17 @@ def save(self, name=None, comment=None, timestamp=None, stats=None, additional_m
'time_end': end.strftime(ISO_FORMAT),
'chunker_params': self.chunker_params,
}
if stats is not None:
metadata.update({
'size': stats.osize,
'csize': stats.csize,
'nfiles': stats.nfiles,
'size_parts': stats.osize_parts,
'csize_parts': stats.csize_parts,
'nfiles_parts': stats.nfiles_parts})
# we always want to create archives with the addtl. metadata (nfiles, etc.),
# because borg info relies on them. so, either use the given stats (from args)
# or fall back to self.stats if it was not given.
stats = stats or self.stats
metadata.update({
'size': stats.osize,
'csize': stats.csize,
'nfiles': stats.nfiles,
'size_parts': stats.osize_parts,
'csize_parts': stats.csize_parts,
'nfiles_parts': stats.nfiles_parts})
metadata.update(additional_metadata or {})
metadata = ArchiveItem(metadata)
data = self.key.pack_and_authenticate_metadata(metadata.as_dict(), context=b'archive')
@ -2242,8 +2245,7 @@ def save(self, archive, target, comment=None, replace_original=True):
'recreate_cmdline': sys.argv,
}
target.save(comment=comment, timestamp=self.timestamp,
stats=target.stats, additional_metadata=additional_metadata)
target.save(comment=comment, timestamp=self.timestamp, additional_metadata=additional_metadata)
if replace_original:
archive.delete(Statistics(), progress=self.progress)
target.rename(archive.name)

View file

@ -626,7 +626,7 @@ def create_inner(archive, cache, fso):
# we already have a checkpoint archive in this case.
self.print_error("Got Ctrl-C / SIGINT.")
else:
archive.save(comment=args.comment, timestamp=args.timestamp, stats=archive.stats)
archive.save(comment=args.comment, timestamp=args.timestamp)
args.stats |= args.json
if args.stats:
if args.json: