diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 6a0d5f516..2895f121e 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -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()