Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion rsync.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2390,7 +2390,9 @@ expand it.

The filenames that are read from the FILE are all relative to the source
dir -- any leading slashes are removed and no ".." references are allowed
to go higher than the source dir. For example, take this command:
to go higher than the source dir. Blank entries are ignored, as are
whole-entry comments that start with '`;`' or '`#`'. For example, take
this command:

> rsync -a --files-from=/tmp/foo /usr remote:/backup

Expand Down
26 changes: 26 additions & 0 deletions testsuite/files-from-depth_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,32 @@ def seed():
for rel in unlisted:
assert_not_exists(TODIR / rel, label=f'--from0 excluded {rel}')

# --- comments: line mode and --from0 both ignore them -----------------------
rmtree(TODIR)
(src / '#ignored').write_text('hash ignored\n')
(src / ';ignored').write_text('semi ignored\n')
commented = SCRATCHDIR / 'files-commented.lst'
commented.write_text('\n'.join(['', ';ignored', '#ignored', *listed]) + '\n')
run_rsync('-a', f'--files-from={commented}', f'{src}/', f'{TODIR}/')
for rel in listed:
assert_same(TODIR / rel, src / rel, label=f'--files-from comment list {rel}')
for rel in unlisted:
assert_not_exists(TODIR / rel, label=f'--files-from comment list excluded {rel}')
for rel in ['#ignored', ';ignored']:
assert_not_exists(TODIR / rel, label=f'--files-from comment list skipped {rel}')

rmtree(TODIR)
comments0 = SCRATCHDIR / 'files-comments0.lst'
comments0.write_bytes(
b'\0;ignored\0#ignored\0' + b'\0'.join(p.encode() for p in listed) + b'\0')
run_rsync('-a', '--from0', f'--files-from={comments0}', f'{src}/', f'{TODIR}/')
for rel in listed:
assert_same(TODIR / rel, src / rel, label=f'--from0 comment list {rel}')
for rel in unlisted:
assert_not_exists(TODIR / rel, label=f'--from0 comment list excluded {rel}')
for rel in ['#ignored', ';ignored']:
assert_not_exists(TODIR / rel, label=f'--from0 comment list skipped {rel}')

# --- --exclude-from drops matching files at depth ---------------------------
seed()
(src / 'a.skip').write_text('s\n')
Expand Down
Loading