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
2 changes: 2 additions & 0 deletions josh-core/src/filter/opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ fn common_post(filters: &Vec<Filter>) -> Option<(Filter, Vec<Filter>)> {
common_post.map(|c| (c, rest))
} else if let Op::Prefix(_) = to_op(c) {
common_post.map(|c| (c, rest))
} else if let Op::Message(..) = to_op(c) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why this was limited to prefix in the first place. Maybe we should look into allowing factorizing all filters here instead of adding more special cases 🤔
Thoughts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer to merge this as a hotfix and then create an issue. For all filters I think we'd need a good test strategy, maybe something like guided fuzzing to discover "unsound" edge cases

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

common_post.map(|c| (c, rest))
} else {
None
}
Expand Down
21 changes: 21 additions & 0 deletions tests/filter/compose_message.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
$ export TESTTMP=${PWD}

$ cd ${TESTTMP}
$ git init -q repo 1> /dev/null
$ cd repo

$ mkdir -p mono extras
$ echo a > mono/a.txt
$ echo b > extras/b.txt
$ git add .
$ git commit -m "initial commit" 1> /dev/null

$ josh-filter -p ':[:/mono,:/extras]:"REWRITTEN"'
:[
:/mono
:/extras
]:"REWRITTEN"

$ josh-filter ':[:/mono,:/extras]:"REWRITTEN"' > /dev/null
$ git log --pretty=%B -1 FILTERED_HEAD
REWRITTEN