Compare commits

...

1 Commits

Author SHA1 Message Date
Ferdinand Schober
dbeaea03ad ignore metadata change on config file
This avoids parsing the config file a second time on change because
of the metadata change.
2026-06-14 17:19:07 +02:00

View File

@@ -1,6 +1,7 @@
use crate::capture_test::TestCaptureArgs; use crate::capture_test::TestCaptureArgs;
use crate::emulation_test::TestEmulationArgs; use crate::emulation_test::TestEmulationArgs;
use clap::{Parser, Subcommand, ValueEnum}; use clap::{Parser, Subcommand, ValueEnum};
use notify::event::ModifyKind;
use notify::{EventKind, RecommendedWatcher, Watcher}; use notify::{EventKind, RecommendedWatcher, Watcher};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::HashMap; use std::collections::HashMap;
@@ -406,7 +407,9 @@ impl Config {
if event.paths.contains(&self.config_path) if event.paths.contains(&self.config_path)
&& matches!( && matches!(
event.kind, event.kind,
EventKind::Create(_) | EventKind::Modify(_) | EventKind::Remove(_) EventKind::Create(_)
| EventKind::Modify(ModifyKind::Data(_))
| EventKind::Remove(_)
) )
&& self.read_from_disk()? && self.read_from_disk()?
{ {
@@ -524,6 +527,11 @@ impl Config {
} }
Err(e) => log::warn!("{:?} {e}", self.config_path()), Err(e) => log::warn!("{:?} {e}", self.config_path()),
}; };
if changed {
log::info!("config changed");
} else {
log::info!("config unchanged");
}
Ok(changed) Ok(changed)
} }