1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-27 10:18:12 +00:00

delete: don't commit if nothing was deleted, avoid cache sync, fixes #6060

This commit is contained in:
Thomas Waldmann 2022-01-30 18:17:49 +01:00
parent a65f298477
commit 20c5c6afbd

View file

@ -1206,6 +1206,7 @@ def _delete_archives(self, args, repository):
msg_delete = 'Would delete archive: {} ({}/{})' if dry_run else 'Deleting archive: {} ({}/{})'
msg_not_found = 'Archive {} not found ({}/{}).'
logger_list = logging.getLogger('borg.output.list')
delete_count = 0
for i, archive_name in enumerate(archive_names, 1):
try:
archive_info = manifest.archives[archive_name]
@ -1219,8 +1220,9 @@ def _delete_archives(self, args, repository):
archive = Archive(repository, key, manifest, archive_name, cache=cache,
consider_part_files=args.consider_part_files)
archive.delete(stats, progress=args.progress, forced=args.forced)
if not dry_run:
delete_count += 1
if delete_count > 0:
# only write/commit if we actually changed something, see #6060.
manifest.write()
repository.commit(compact=False, save_space=args.save_space)
cache.commit()