Repository navigation
feat: wire per-directory merge filters into transfer layer - #3034
Merged
Merged
Conversation
Replace the flat `Option<FilterSet>` in GeneratorContext with a `FilterChain` that supports per-directory scoped rules. During `walk_path()`, the generator now calls `enter_directory()` / `leave_directory()` to read `.rsync-filter` files and push/pop scoped rules as directories are entered and left, matching upstream rsync's `push_local_filters()` / `pop_local_filters()` pattern. Wire `FilterChain` into the receiver for deletion protection: `delete_extraneous_files()` now evaluates `allows_deletion()` before removing destination files, respecting protect/risk rules. DirMerge rules from the wire protocol are no longer silently skipped - they are extracted into `DirMergeConfig` entries and registered on the `FilterChain` for per-directory merge file scanning. Key changes: - GeneratorContext.filters -> filter_chain (FilterChain) - parse_received_filters returns (FilterSet, Vec<DirMergeConfig>) - walk_path enters/leaves directories on the filter chain - ReceiverContext gains filter_chain for deletion filtering - setup_transfer builds FilterChain from received wire rules - wire_rule_to_dir_merge_config maps wire modifiers to DirMergeConfig
oferchen
added a commit
that referenced
this pull request
May 1, 2026
Replace the flat `Option<FilterSet>` in GeneratorContext with a `FilterChain` that supports per-directory scoped rules. During `walk_path()`, the generator now calls `enter_directory()` / `leave_directory()` to read `.rsync-filter` files and push/pop scoped rules as directories are entered and left, matching upstream rsync's `push_local_filters()` / `pop_local_filters()` pattern. Wire `FilterChain` into the receiver for deletion protection: `delete_extraneous_files()` now evaluates `allows_deletion()` before removing destination files, respecting protect/risk rules. DirMerge rules from the wire protocol are no longer silently skipped - they are extracted into `DirMergeConfig` entries and registered on the `FilterChain` for per-directory merge file scanning. Key changes: - GeneratorContext.filters -> filter_chain (FilterChain) - parse_received_filters returns (FilterSet, Vec<DirMergeConfig>) - walk_path enters/leaves directories on the filter chain - ReceiverContext gains filter_chain for deletion filtering - setup_transfer builds FilterChain from received wire rules - wire_rule_to_dir_merge_config maps wire modifiers to DirMergeConfig
oferchen
added a commit
that referenced
this pull request
May 5, 2026
Replace the flat `Option<FilterSet>` in GeneratorContext with a `FilterChain` that supports per-directory scoped rules. During `walk_path()`, the generator now calls `enter_directory()` / `leave_directory()` to read `.rsync-filter` files and push/pop scoped rules as directories are entered and left, matching upstream rsync's `push_local_filters()` / `pop_local_filters()` pattern. Wire `FilterChain` into the receiver for deletion protection: `delete_extraneous_files()` now evaluates `allows_deletion()` before removing destination files, respecting protect/risk rules. DirMerge rules from the wire protocol are no longer silently skipped - they are extracted into `DirMergeConfig` entries and registered on the `FilterChain` for per-directory merge file scanning. Key changes: - GeneratorContext.filters -> filter_chain (FilterChain) - parse_received_filters returns (FilterSet, Vec<DirMergeConfig>) - walk_path enters/leaves directories on the filter chain - ReceiverContext gains filter_chain for deletion filtering - setup_transfer builds FilterChain from received wire rules - wire_rule_to_dir_merge_config maps wire modifiers to DirMergeConfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Option<FilterSet>inGeneratorContextwithFilterChainfor per-directory scoped filter ruleswalk_path()now callsenter_directory()/leave_directory()on the filter chain during recursive directory traversal, reading.rsync-filtermerge files per upstreampush_local_filters()/pop_local_filters()patternDirMergeConfigentries instead of being silently skippeddelete_extraneous_files()evaluatesFilterChain::allows_deletion()before removing destination files, respecting protect/risk rulessetup_transfer()builds aFilterChainfrom received wire filter rules for deletion filteringTest plan