From 4e6319f5d3b0b7c69a84294cbc0904404ab10e40 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Fri, 9 Jan 2026 12:12:42 -0800 Subject: [PATCH] In the "export-tar" action, fix the use of "--log-json" when exporting to stdout (#485). --- borgmatic/borg/export_tar.py | 2 +- tests/unit/borg/test_export_tar.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/borgmatic/borg/export_tar.py b/borgmatic/borg/export_tar.py index 51a1d0f2..5028ce8e 100644 --- a/borgmatic/borg/export_tar.py +++ b/borgmatic/borg/export_tar.py @@ -41,7 +41,7 @@ def export_tar_archive( (local_path, 'export-tar') + (('--remote-path', remote_path) if remote_path else ()) + (('--umask', str(umask)) if umask else ()) - + ('--log-json',) + + (('--log-json',) if destination_path != '-' else ()) + (('--lock-wait', str(lock_wait)) if lock_wait else ()) + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ()) + (('--list',) if config.get('list_details') else ()) diff --git a/tests/unit/borg/test_export_tar.py b/tests/unit/borg/test_export_tar.py index e2c7f84b..58573789 100644 --- a/tests/unit/borg/test_export_tar.py +++ b/tests/unit/borg/test_export_tar.py @@ -368,9 +368,7 @@ def test_export_tar_archive_calls_borg_with_stdout_destination_path(): flexmock(module.flags).should_receive('make_repository_archive_flags').and_return( ('repo::archive',), ) - insert_execute_command_mock( - ('borg', 'export-tar', '--log-json', 'repo::archive', '-'), capture=False - ) + insert_execute_command_mock(('borg', 'export-tar', 'repo::archive', '-'), capture=False) module.export_tar_archive( dry_run=False,