Skip to content

Commit 559956e

Browse files
Fix message filter being put in wrong position by optimizer
1 parent 1f8b7a7 commit 559956e

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

josh-core/src/filter/opt.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ fn common_post(filters: &Vec<Filter>) -> Option<(Filter, Vec<Filter>)> {
315315
common_post.map(|c| (c, rest))
316316
} else if let Op::Prefix(_) = to_op(c) {
317317
common_post.map(|c| (c, rest))
318+
} else if let Op::Message(..) = to_op(c) {
319+
common_post.map(|c| (c, rest))
318320
} else {
319321
None
320322
}

tests/filter/compose_message.t

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
$ export TESTTMP=${PWD}
2+
3+
$ cd ${TESTTMP}
4+
$ git init -q repo 1> /dev/null
5+
$ cd repo
6+
7+
$ mkdir -p mono extras
8+
$ echo a > mono/a.txt
9+
$ echo b > extras/b.txt
10+
$ git add .
11+
$ git commit -m "initial commit" 1> /dev/null
12+
13+
$ josh-filter -p ':[:/mono,:/extras]:"REWRITTEN"'
14+
:[
15+
:/mono
16+
:/extras
17+
]:"REWRITTEN"
18+
19+
$ josh-filter ':[:/mono,:/extras]:"REWRITTEN"' > /dev/null
20+
$ git log --pretty=%B -1 FILTERED_HEAD
21+
REWRITTEN

0 commit comments

Comments
 (0)