Pārlūkot izejas kodu

Fix for garbled Borg file listing when using "borgmatic create --progress" with verbosity level 1 or 2 (#257).

Dan Helfman 5 gadi atpakaļ
vecāks
revīzija
9b2ca15de6
3 mainītis faili ar 34 papildinājumiem un 2 dzēšanām
  1. 4 1
      NEWS
  2. 5 1
      borgmatic/borg/create.py
  3. 25 0
      tests/unit/borg/test_create.py

+ 4 - 1
NEWS

@@ -1,5 +1,8 @@
 1.4.16
- * Fix for missing Healthchecks monitoring payload or HTTP 500 due to incorrect unicode encoding.
+ * #257: Fix for garbled Borg file listing when using "borgmatic create --progress" with
+   verbosity level 1 or 2.
+ * #260: Fix for missing Healthchecks monitoring payload or HTTP 500 due to incorrect unicode
+   encoding.
 
 1.4.15
  * Fix for database dump removal incorrectly skipping some database dumps.

+ 5 - 1
borgmatic/borg/create.py

@@ -170,7 +170,11 @@ def create_archive(
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--umask', str(umask)) if umask else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
-        + (('--list', '--filter', 'AME-') if logger.isEnabledFor(logging.INFO) and not json else ())
+        + (
+            ('--list', '--filter', 'AME-')
+            if logger.isEnabledFor(logging.INFO) and not json and not progress
+            else ()
+        )
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO and not json else ())
         + (
             ('--stats',)

+ 25 - 0
tests/unit/borg/test_create.py

@@ -821,6 +821,31 @@ def test_create_archive_with_stats_calls_borg_with_stats_parameter():
     )
 
 
+def test_create_archive_with_progress_and_log_info_calls_borg_with_progress_parameter_and_no_list():
+    flexmock(module).should_receive('borgmatic_source_directories').and_return([])
+    flexmock(module).should_receive('_expand_directories').and_return(('foo', 'bar'))
+    flexmock(module).should_receive('_expand_home_directories').and_return(())
+    flexmock(module).should_receive('_write_pattern_file').and_return(None)
+    flexmock(module).should_receive('_make_pattern_flags').and_return(())
+    flexmock(module).should_receive('_make_exclude_flags').and_return(())
+    flexmock(module).should_receive('execute_command_without_capture').with_args(
+        ('borg', 'create', '--info', '--stats', '--progress') + ARCHIVE_WITH_PATHS
+    )
+    insert_logging_mock(logging.INFO)
+
+    module.create_archive(
+        dry_run=False,
+        repository='repo',
+        location_config={
+            'source_directories': ['foo', 'bar'],
+            'repositories': ['repo'],
+            'exclude_patterns': None,
+        },
+        storage_config={},
+        progress=True,
+    )
+
+
 def test_create_archive_with_progress_calls_borg_with_progress_parameter():
     flexmock(module).should_receive('borgmatic_source_directories').and_return([])
     flexmock(module).should_receive('_expand_directories').and_return(('foo', 'bar'))