fix dry run not working borg 1.4.1+

This commit is contained in:
Vandal
2025-04-26 00:21:48 +05:30
parent 4e05539825
commit 1cde65b4eb
2 changed files with 7 additions and 0 deletions
+5
View File
@@ -37,6 +37,11 @@ def compact_segments(
+ (('--threshold', str(threshold)) if threshold else ())
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
+ (
('--dry-run',)
if dry_run and feature.available(feature.Feature.DRY_RUN_COMPACT, local_borg_version)
else ()
)
+ (tuple(extra_borg_options.split(' ')) if extra_borg_options else ())
+ flags.make_repository_flags(repository_path, local_borg_version)
)
+2
View File
@@ -73,6 +73,8 @@ def test_compact_segments_with_dry_run_skips_borg_call_when_feature_unavailable(
flexmock(module.feature).should_receive('available').with_args(
module.feature.Feature.DRY_RUN_COMPACT, '1.2.3'
).and_return(False)
flexmock(module.environment).should_receive('make_environment').never()
flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').never()
flexmock(module).should_receive('execute_command').never()
flexmock(logging).should_receive('info').with_args('Skipping compact (dry run)').once()