mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-20 21:27:32 +00:00
add test for preserved intermediate folder permissions (#2477)
This tests whether the permissions metadata is preserved when a folder is excluded but still recursed into to find a matching file in a subfolder.
This commit is contained in:
parent
8268090f8e
commit
ed14181cc1
1 changed files with 25 additions and 0 deletions
|
@ -1002,6 +1002,31 @@ def test_create_pattern_exclude_folder_no_recurse(self):
|
|||
self.assert_not_in('input/x/a', output)
|
||||
self.assert_in('A input/y/foo_y', output)
|
||||
|
||||
def test_create_pattern_intermediate_folders_first(self):
|
||||
"""test that intermediate folders appear first when patterns exclude a parent folder but include a child"""
|
||||
self.patterns_file_path2 = os.path.join(self.tmpdir, 'patterns2')
|
||||
with open(self.patterns_file_path2, 'wb') as fd:
|
||||
fd.write(b'+ input/x/a\n+ input/x/b\n- input/x*\n')
|
||||
|
||||
self.cmd('init', '--encryption=repokey', self.repository_location)
|
||||
|
||||
self.create_regular_file('x/a/foo_a', size=1024 * 80)
|
||||
self.create_regular_file('x/b/foo_b', size=1024 * 80)
|
||||
with changedir('input'):
|
||||
self.cmd('create', '--patterns-from=' + self.patterns_file_path2,
|
||||
self.repository_location + '::test', '.')
|
||||
|
||||
# list the archive and verify that the "intermediate" folders appear before
|
||||
# their contents
|
||||
out = self.cmd('list', '--format', '{type} {path}{NL}', self.repository_location + '::test')
|
||||
out_list = out.splitlines()
|
||||
|
||||
self.assert_in('d x/a', out_list)
|
||||
self.assert_in('d x/b', out_list)
|
||||
|
||||
assert out_list.index('d x/a') < out_list.index('- x/a/foo_a')
|
||||
assert out_list.index('d x/b') < out_list.index('- x/b/foo_b')
|
||||
|
||||
def test_extract_pattern_opt(self):
|
||||
self.cmd('init', '--encryption=repokey', self.repository_location)
|
||||
self.create_regular_file('file1', size=1024 * 80)
|
||||
|
|
Loading…
Reference in a new issue