Unify includes and excludes into single ordered pattern list
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16
- Forks
- 3
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 121
Description
The file content attachment handler should not separate includes and excludes into separate collections, but instead maintain a single ordered list of patterns where order matters for precedence, similar to how gitignore files work.
Context
Currently, the FileContent struct maintains separate BTreeSet<Pattern> collections for includes and excludes. However, this approach doesn't align with how gitignore patterns work, where the order of patterns matters for precedence.
In gitignore syntax, patterns are evaluated in order, and later patterns can override earlier ones. For example:
foo/(exclude all foo directories)!foo/important.txt(but include this specific file)
The current approach makes it impossible to have proper precedence because includes and excludes are processed separately, and the CLI argument order (-a one -a two) should be preserved so that two is processed after one.
Proposed Implementation
-
Replace the separate
includesandexcludesfields with a singlepatterns: Vec<(Pattern, bool)>where the boolean indicates whether it's an include (true) or exclude (false) pattern. -
Modify the
addmethod to append patterns to this vector in order, preserving the CLI argument sequence. -
Update the
getmethod to process patterns in order when building theOverrideBuilder. -
Update the
listmethod to return patterns in their original order. -
Update the serialization to preserve order (using
Vecinstead ofBTreeSet).
Resources
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in crates/jp_attachment_file_content/src/lib.rs, especially the FileContent fields and its add, get, and list methods. Trace how OverrideBuilder and serialization use the patterns, then verify that CLI argument order and serialized output preserve precedence and original ordering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100