Skip to content

Commit 2af07e7

Browse files
committed
ignore some events
1 parent 9d5273b commit 2af07e7

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### next
22
- default binding for 'c' in bacon.toml is now the new 'clippy-all' job which does what the old 'clippy' job was doing. 'clippy' job changed to not run on all targets. Default bacon.toml explain how to bind 'c' to clippy instead of 'clippy-all' - Fix #167
33
- expand env vars in job command unless the job specifies `expand_env_vars = false` - Fix #181
4+
- some file events filtered out from watch (feedback welcome, especially if you notice some failures to recompute)
45

56
<a name="v2.16.0"></a>
67
### v2.16.0 - 2024/03/30

src/app.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ use {
77
select,
88
},
99
notify::event::{
10+
AccessKind,
11+
AccessMode,
12+
DataChange,
1013
EventKind,
1114
ModifyKind,
1215
},
@@ -37,14 +40,25 @@ pub fn run(
3740
let mut watcher =
3841
notify::recommended_watcher(move |res: notify::Result<notify::Event>| match res {
3942
Ok(we) => {
40-
info!("notify event: {we:?}");
4143
match we.kind {
42-
EventKind::Modify(ModifyKind::Data(_)) => {}
43-
EventKind::Create(_) => {} // just in case, not sure useful in Rust
44-
EventKind::Remove(_) => {} // just in case, not sure useful in Rust
45-
_ => {
44+
EventKind::Modify(ModifyKind::Metadata(_)) => {
45+
info!("ignoring metadata change");
4646
return; // useless event
4747
}
48+
EventKind::Modify(ModifyKind::Data(DataChange::Any)) => {
49+
info!("ignoring 'any' data change");
50+
return; // probably useless event with no real change
51+
}
52+
EventKind::Access(AccessKind::Close(AccessMode::Write)) => {
53+
info!("close write event: {we:?}");
54+
}
55+
EventKind::Access(_) => {
56+
info!("ignoring access event: {we:?}");
57+
return; // probably useless event
58+
}
59+
_ => {
60+
info!("notify event: {we:?}");
61+
}
4862
}
4963
if let Some(ignorer) = ignorer.as_mut() {
5064
match time!(Info, ignorer.excludes_all(&we.paths)) {

0 commit comments

Comments
 (0)