Fix a bug in which the "compact" action does not pass a compact threshold of zero to Borg.

This commit is contained in:
Dan Helfman
2026-06-06 15:31:29 -07:00
parent 219282b5fa
commit d74b340024
4 changed files with 21 additions and 2 deletions
+3
View File
@@ -1,3 +1,6 @@
2.1.7.dev0
* Fix a bug in which the "compact" action does not pass a compact threshold of zero to Borg.
2.1.6
* #1256: Fix a race condition in which borgmatic sometimes swallows Borg error output without
logging it.
+1 -1
View File
@@ -35,7 +35,7 @@ def compact_segments(
+ (('--lock-wait', str(lock_wait)) if lock_wait else ())
+ (('--progress',) if config.get('progress') else ())
+ (('--cleanup-commits',) if cleanup_commits else ())
+ (('--threshold', str(threshold)) if threshold else ())
+ (('--threshold', str(threshold)) if threshold is not None else ())
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
+ (
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "borgmatic"
version = "2.1.6"
version = "2.1.7.dev0"
authors = [
{ name="Dan Helfman", email="witten@torsion.org" },
]
+16
View File
@@ -229,6 +229,22 @@ def test_compact_segments_with_threshold_calls_borg_with_threshold_flag():
)
def test_compact_segments_with_zero_threshold_calls_borg_with_threshold_flag():
flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',))
insert_execute_command_mock(
(*COMPACT_COMMAND, '--log-json', '--threshold', '0', 'repo'), logging.INFO
)
insert_logging_mock(logging.WARNING)
module.compact_segments(
dry_run=False,
repository_path='repo',
config={'compact_threshold': 0},
local_borg_version='1.2.3',
global_arguments=flexmock(),
)
def test_compact_segments_with_umask_calls_borg_with_umask_flags():
config = {'umask': '077'}
flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',))