Просмотр исходного кода

repoobj.format: mutate meta

we should modify the meta dict given by the caller, so the caller can know
about e.g. the compression/obfuscation that was done (this is useful for rcompress).
Thomas Waldmann 2 лет назад
Родитель
Сommit
acc5d9870a
2 измененных файлов с 1 добавлено и 2 удалено
  1. 0 1
      src/borg/repoobj.py
  2. 1 1
      src/borg/testsuite/repoobj.py

+ 0 - 1
src/borg/repoobj.py

@@ -35,7 +35,6 @@ class RepoObj:
     ) -> bytes:
         assert isinstance(id, bytes)
         assert isinstance(meta, dict)
-        meta = dict(meta)  # make a copy, so call arg is not modified
         assert isinstance(data, (bytes, memoryview))
         assert compress or size is not None and ctype is not None and clevel is not None
         if compress:

+ 1 - 1
src/borg/testsuite/repoobj.py

@@ -78,7 +78,7 @@ def test_borg1_borg2_transition(key):
     # note: as we did not decompress, we do not have "size" and we need to get it from somewhere else.
     # here, we just use len_data. for borg transfer, we also know the size from another metadata source.
     borg2_cdata = repo_objs2.format(
-        id, meta1, compr_data1[2:], compress=False, size=len_data, ctype=meta1["ctype"], clevel=meta1["clevel"]
+        id, dict(meta1), compr_data1[2:], compress=False, size=len_data, ctype=meta1["ctype"], clevel=meta1["clevel"]
     )
     meta2, data2 = repo_objs2.parse(id, borg2_cdata)
     assert data2 == data