Browse Source

diff: more precise warning msgs for different chunker params

if we know both archives' chunker params, use "are different" not "might be".
also do not recommend to enforce it using --same-chunker-params in this case.
Thomas Waldmann 2 years ago
parent
commit
3200190cdb
1 changed files with 10 additions and 3 deletions
  1. 10 3
      src/borg/archiver.py

+ 10 - 3
src/borg/archiver.py

@@ -1127,9 +1127,16 @@ class Archiver:
 
         cp1 = archive1.metadata.get('chunker_params')
         cp2 = archive2.metadata.get('chunker_params')
-        can_compare_chunk_ids = (args.same_chunker_params or
-            cp1 is not None and cp2 is not None and normalize_chunker_params(cp1) == normalize_chunker_params(cp2))
-        if not can_compare_chunk_ids:
+        if args.same_chunker_params:
+            can_compare_chunk_ids = True  # enforce it
+        elif cp1 is not None and cp2 is not None:
+            # we know chunker params of both archives
+            can_compare_chunk_ids = normalize_chunker_params(cp1) == normalize_chunker_params(cp2)
+            if not can_compare_chunk_ids:
+                self.print_warning('--chunker-params are different between archives, diff will be slow.')
+        else:
+            # we do not know chunker params of at least one of the archives
+            can_compare_chunk_ids = False
             self.print_warning('--chunker-params might be different between archives, diff will be slow.\n'
                                'If you know for certain that they are the same, pass --same-chunker-params '
                                'to override this check.')