Repository navigation
feat: add FilterChain for per-directory merge filter scoping - #3033
Merged
Merged
Conversation
Implement FilterChain in the filters crate, providing a scoped filter evaluation stack that mirrors upstream rsync's push_local_filters()/pop_local_filters() from exclude.c. Key components: - FilterChain: manages global FilterSet + per-directory scope stack - DirMergeConfig: configures merge file behavior (inherit, exclude-self, sender/receiver-only, anchor-root, perishable modifiers) - DirFilterGuard: tracks pushed scopes for leave_directory() cleanup - FilterChainError: covers I/O, parse, and compilation failures The chain evaluates paths from innermost scope outward to global rules, with first-match-wins semantics at each layer. Missing merge files are silently skipped, matching upstream behavior. Includes comprehensive tests for: scope push/pop, nested directories, merge file reading, empty/missing files, modifier application, multiple merge configs, parse errors, protect rules, and guard lifetime.
oferchen
added a commit
that referenced
this pull request
May 1, 2026
* feat: add FilterChain for per-directory merge filter scoping Implement FilterChain in the filters crate, providing a scoped filter evaluation stack that mirrors upstream rsync's push_local_filters()/pop_local_filters() from exclude.c. Key components: - FilterChain: manages global FilterSet + per-directory scope stack - DirMergeConfig: configures merge file behavior (inherit, exclude-self, sender/receiver-only, anchor-root, perishable modifiers) - DirFilterGuard: tracks pushed scopes for leave_directory() cleanup - FilterChainError: covers I/O, parse, and compilation failures The chain evaluates paths from innermost scope outward to global rules, with first-match-wins semantics at each layer. Missing merge files are silently skipped, matching upstream behavior. Includes comprehensive tests for: scope push/pop, nested directories, merge file reading, empty/missing files, modifier application, multiple merge configs, parse errors, protect rules, and guard lifetime. * style: fix rustfmt multi-line if conditions in FilterChain
oferchen
added a commit
that referenced
this pull request
May 5, 2026
* feat: add FilterChain for per-directory merge filter scoping Implement FilterChain in the filters crate, providing a scoped filter evaluation stack that mirrors upstream rsync's push_local_filters()/pop_local_filters() from exclude.c. Key components: - FilterChain: manages global FilterSet + per-directory scope stack - DirMergeConfig: configures merge file behavior (inherit, exclude-self, sender/receiver-only, anchor-root, perishable modifiers) - DirFilterGuard: tracks pushed scopes for leave_directory() cleanup - FilterChainError: covers I/O, parse, and compilation failures The chain evaluates paths from innermost scope outward to global rules, with first-match-wins semantics at each layer. Missing merge files are silently skipped, matching upstream behavior. Includes comprehensive tests for: scope push/pop, nested directories, merge file reading, empty/missing files, modifier application, multiple merge configs, parse errors, protect rules, and guard lifetime. * style: fix rustfmt multi-line if conditions in FilterChain
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
FilterChaintype to thefilterscrate, implementing upstream rsync's per-directory merge filter push/pop semantics fromexclude.c:push_local_filters()/pop_local_filters()DirMergeConfigfor configuring per-directory merge file behavior (filename, inherit, exclude-self, sender/receiver-only, anchor-root, perishable modifiers)DirFilterGuardfor tracking pushed scopes andFilterChainErrorfor error handlingTest plan
DirMergeConfigconstruction and modifier applicationFilterChainbasic operations (empty, global rules, deletion)push_scope/leave_directoryenter_directory)exclude_selfmodifierFilterChainErrordisplay and source-D warnings