mirror of
https://github.com/watchexec/watchexec.git
synced 2024-09-28 22:21:33 +02:00
Reduce swaplock hold for tagged compile globs
This commit is contained in:
parent
f073eeb344
commit
8219e577d0
@ -163,9 +163,11 @@ impl TaggedFilterer {
|
|||||||
if let (Matcher::Path, Tag::Path { path, file_type }) = (matcher, tag) {
|
if let (Matcher::Path, Tag::Path { path, file_type }) = (matcher, tag) {
|
||||||
let is_dir = file_type.map_or(false, |ft| matches!(ft, FileType::Dir));
|
let is_dir = file_type.map_or(false, |ft| matches!(ft, FileType::Dir));
|
||||||
|
|
||||||
|
{
|
||||||
let gc = self.glob_compiled.borrow();
|
let gc = self.glob_compiled.borrow();
|
||||||
if let Some(igs) = gc.as_ref() {
|
if let Some(igs) = gc.as_ref() {
|
||||||
let _span = trace_span!("checking_compiled_filters", compiled=%"Glob")
|
let _span =
|
||||||
|
trace_span!("checking_compiled_filters", compiled=%"Glob")
|
||||||
.entered();
|
.entered();
|
||||||
match if path.strip_prefix(&self.origin).is_ok() {
|
match if path.strip_prefix(&self.origin).is_ok() {
|
||||||
trace!("checking against path or parents");
|
trace!("checking against path or parents");
|
||||||
@ -179,11 +181,17 @@ impl TaggedFilterer {
|
|||||||
tag_match &= false;
|
tag_match &= false;
|
||||||
}
|
}
|
||||||
Match::Ignore(glob) => {
|
Match::Ignore(glob) => {
|
||||||
if glob.from().map_or(true, |f| path.strip_prefix(f).is_ok()) {
|
if glob
|
||||||
|
.from()
|
||||||
|
.map_or(true, |f| path.strip_prefix(f).is_ok())
|
||||||
|
{
|
||||||
trace!(?glob, "positive match (pass)");
|
trace!(?glob, "positive match (pass)");
|
||||||
tag_match &= true;
|
tag_match &= true;
|
||||||
} else {
|
} else {
|
||||||
trace!(?glob, "positive match, but not in scope (ignore)");
|
trace!(
|
||||||
|
?glob,
|
||||||
|
"positive match, but not in scope (ignore)"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Match::Whitelist(glob) => {
|
Match::Whitelist(glob) => {
|
||||||
@ -191,7 +199,9 @@ impl TaggedFilterer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
let ngc = self.not_glob_compiled.borrow();
|
let ngc = self.not_glob_compiled.borrow();
|
||||||
if let Some(ngs) = ngc.as_ref() {
|
if let Some(ngs) = ngc.as_ref() {
|
||||||
let _span =
|
let _span =
|
||||||
@ -209,11 +219,17 @@ impl TaggedFilterer {
|
|||||||
tag_match &= true;
|
tag_match &= true;
|
||||||
}
|
}
|
||||||
Match::Ignore(glob) => {
|
Match::Ignore(glob) => {
|
||||||
if glob.from().map_or(true, |f| path.strip_prefix(f).is_ok()) {
|
if glob
|
||||||
|
.from()
|
||||||
|
.map_or(true, |f| path.strip_prefix(f).is_ok())
|
||||||
|
{
|
||||||
trace!(?glob, "positive match (fail)");
|
trace!(?glob, "positive match (fail)");
|
||||||
tag_match &= false;
|
tag_match &= false;
|
||||||
} else {
|
} else {
|
||||||
trace!(?glob, "positive match, but not in scope (ignore)");
|
trace!(
|
||||||
|
?glob,
|
||||||
|
"positive match, but not in scope (ignore)"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Match::Whitelist(glob) => {
|
Match::Whitelist(glob) => {
|
||||||
@ -223,6 +239,7 @@ impl TaggedFilterer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// those are handled with the compiled ignore filters above
|
// those are handled with the compiled ignore filters above
|
||||||
let tag_filters = tag_filters
|
let tag_filters = tag_filters
|
||||||
|
Loading…
Reference in New Issue
Block a user