Feature: Rich filter rules and file lists (--filter, --files-from, --exclude-from) #175

Closed
opened 2026-07-30 18:31:43 +02:00 by TapTap · 0 comments
Owner

Corresponding rsync flags/behavior:

  • --include, --exclude — filter rules (currently supported only as filename globs)
  • --filter — rich include/exclude rule language with include/exclude/delete/protect actions
  • --files-from=FILE — transfer only paths listed in a file
  • --exclude-from=FILE, --include-from=FILE — read patterns from a file

Current FastSync behavior:
scanner.c:111-135 matches --exclude/--include only against entry->d_name (the bare filename), using a simple glob matcher in utils.c:59. There is no support for directory matching, anchored paths, rule files, or rsync-style filter syntax.

Proposed changes:

  • CLI flags: --filter, --files-from=<file>, --exclude-from=<file>, --include-from=<file>
  • Config fields: add FilterRule* filter_rules list; each rule has type (include/exclude), pattern, and anchor flags
  • Scanner changes:
    • Match against the full relative path, not just the filename
    • Support anchored patterns (/foo), directory patterns (foo/), and recursive rules (**)
    • Support --files-from to bypass directory scanning and only transfer listed paths
  • Protocol: no wire changes; filters are applied client-side

Priority: medium
Rationale: Advanced filtering is essential for syncing large trees (e.g., exclude all .git/ directories anywhere, include only a specific subtree). Current filename-only globs are too limited.

Acceptance criteria:

  • --exclude '/build/' excludes any directory named build at any depth
  • --files-from=list.txt transfers exactly the listed relative paths
  • --filter='- *.tmp' produces the same result as --exclude '*.tmp'
  • Integration tests cover path-anchored rules and --files-from
**Corresponding rsync flags/behavior:** - `--include`, `--exclude` — filter rules (currently supported only as filename globs) - `--filter` — rich include/exclude rule language with include/exclude/delete/protect actions - `--files-from=FILE` — transfer only paths listed in a file - `--exclude-from=FILE`, `--include-from=FILE` — read patterns from a file **Current FastSync behavior:** `scanner.c:111-135` matches `--exclude`/`--include` only against `entry->d_name` (the bare filename), using a simple glob matcher in `utils.c:59`. There is no support for directory matching, anchored paths, rule files, or rsync-style filter syntax. **Proposed changes:** - CLI flags: `--filter`, `--files-from=<file>`, `--exclude-from=<file>`, `--include-from=<file>` - Config fields: add `FilterRule* filter_rules` list; each rule has type (include/exclude), pattern, and anchor flags - Scanner changes: - Match against the full relative path, not just the filename - Support anchored patterns (`/foo`), directory patterns (`foo/`), and recursive rules (`**`) - Support `--files-from` to bypass directory scanning and only transfer listed paths - Protocol: no wire changes; filters are applied client-side **Priority:** medium **Rationale:** Advanced filtering is essential for syncing large trees (e.g., exclude all `.git/` directories anywhere, include only a specific subtree). Current filename-only globs are too limited. **Acceptance criteria:** - [ ] `--exclude '/build/'` excludes any directory named `build` at any depth - [ ] `--files-from=list.txt` transfers exactly the listed relative paths - [ ] `--filter='- *.tmp'` produces the same result as `--exclude '*.tmp'` - [ ] Integration tests cover path-anchored rules and `--files-from`
TapTap added the enhancementneeds-triage labels 2026-07-30 18:31:43 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#175