From 528dc6fe878a419e73550b2b40a15eb437f19956 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Fri, 9 Jan 2026 12:01:21 -0800 Subject: [PATCH] For the "mount" action, fix use of "--log-json" when "--foreground" is set (#485). --- borgmatic/borg/mount.py | 2 +- tests/unit/borg/test_mount.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/borgmatic/borg/mount.py b/borgmatic/borg/mount.py index 041c1e72..9561bbe1 100644 --- a/borgmatic/borg/mount.py +++ b/borgmatic/borg/mount.py @@ -32,7 +32,7 @@ def mount_archive( (local_path, 'mount') + (('--remote-path', remote_path) if remote_path else ()) + (('--umask', str(umask)) if umask else ()) - + ('--log-json',) + + (('--log-json',) if not mount_arguments.foreground else ()) + (('--lock-wait', str(lock_wait)) if lock_wait else ()) + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ()) + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ()) diff --git a/tests/unit/borg/test_mount.py b/tests/unit/borg/test_mount.py index 00fed9b6..4d3fe57a 100644 --- a/tests/unit/borg/test_mount.py +++ b/tests/unit/borg/test_mount.py @@ -273,7 +273,7 @@ def test_mount_archive_calls_borg_with_foreground_parameter(): flexmock(module.environment).should_receive('make_environment') flexmock(module.borgmatic.config.paths).should_receive('get_working_directory').and_return(None) flexmock(module).should_receive('execute_command').with_args( - ('borg', 'mount', '--log-json', '--foreground', 'repo::archive', '/mnt'), + ('borg', 'mount', '--foreground', 'repo::archive', '/mnt'), output_file=module.DO_NOT_CAPTURE, environment=None, working_directory=None,