matched_ignore() — tailwindcss Function Reference
Architecture documentation for the matched_ignore() function in dir.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD bc27902d_86a1_5533_1198_836c4e5c562b["matched_ignore()"] 22918057_f3e8_c59b_6372_a4375af46acd["matched()"] 22918057_f3e8_c59b_6372_a4375af46acd -->|calls| bc27902d_86a1_5533_1198_836c4e5c562b 88cfdf66_972d_521a_fce8_ab5e94cc109e["parents()"] bc27902d_86a1_5533_1198_836c4e5c562b -->|calls| 88cfdf66_972d_521a_fce8_ab5e94cc109e 2ec2d834_e4a3_2702_3438_71c3ba441cd8["absolute_base()"] bc27902d_86a1_5533_1198_836c4e5c562b -->|calls| 2ec2d834_e4a3_2702_3438_71c3ba441cd8 22918057_f3e8_c59b_6372_a4375af46acd["matched()"] bc27902d_86a1_5533_1198_836c4e5c562b -->|calls| 22918057_f3e8_c59b_6372_a4375af46acd a3791d58_6294_cb66_0418_5756e23761fd["path()"] bc27902d_86a1_5533_1198_836c4e5c562b -->|calls| a3791d58_6294_cb66_0418_5756e23761fd style bc27902d_86a1_5533_1198_836c4e5c562b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
crates/ignore/src/dir.rs lines 408–533
fn matched_ignore<'a>(&'a self, path: &Path, is_dir: bool) -> Match<IgnoreMatch<'a>> {
let (mut m_custom_ignore, mut m_ignore, mut m_gi, mut m_gi_exclude, mut m_explicit) = (
Match::None,
Match::None,
Match::None,
Match::None,
Match::None,
);
let any_git = !self.0.opts.require_git || self.parents().any(|ig| ig.0.has_git);
let mut saw_git = false;
for ig in self.parents().take_while(|ig| !ig.0.is_absolute_parent) {
if m_custom_ignore.is_none() {
m_custom_ignore =
ig.0.custom_ignore_matcher
.matched(path, is_dir)
.map(IgnoreMatch::gitignore);
}
if m_ignore.is_none() {
m_ignore =
ig.0.ignore_matcher
.matched(path, is_dir)
.map(IgnoreMatch::gitignore);
}
if any_git && !saw_git && m_gi.is_none() {
m_gi =
ig.0.git_ignore_matcher
.matched(path, is_dir)
.map(IgnoreMatch::gitignore);
}
if any_git && !saw_git && m_gi_exclude.is_none() {
m_gi_exclude =
ig.0.git_exclude_matcher
.matched(path, is_dir)
.map(IgnoreMatch::gitignore);
}
saw_git = saw_git || ig.0.has_git;
}
if self.0.opts.parents {
if let Some(_) = self.absolute_base() {
// CHANGED: We removed a code path that rewrote the `path` to be relative to
// `self.absolute_base()` because it assumed that the every path is inside the base
// which is not the case for us as we use `WalkBuilder#add` to add roots outside of the
// base.
for ig in self.parents().skip_while(|ig| !ig.0.is_absolute_parent) {
if m_custom_ignore.is_none() {
m_custom_ignore =
ig.0.custom_ignore_matcher
.matched(&path, is_dir)
.map(IgnoreMatch::gitignore);
}
if m_ignore.is_none() {
m_ignore =
ig.0.ignore_matcher
.matched(&path, is_dir)
.map(IgnoreMatch::gitignore);
}
if any_git && !saw_git && m_gi.is_none() {
m_gi =
ig.0.git_ignore_matcher
.matched(&path, is_dir)
.map(IgnoreMatch::gitignore);
}
if any_git && !saw_git && m_gi_exclude.is_none() {
m_gi_exclude =
ig.0.git_exclude_matcher
.matched(&path, is_dir)
.map(IgnoreMatch::gitignore);
}
saw_git = saw_git || ig.0.has_git;
}
}
}
for gi in self.0.explicit_ignores.iter().rev() {
// CHANGED: We need to make sure that the explicit gitignore rules apply to the path
//
// path = Is the current file/folder we are traversing
// gi.path() = Is the path of the custom gitignore file
//
// E.g.: If we have a custom rule for `/src/utils` with `**/*`, and we are looking at
// just `/src`, then the `**/*` rules do not apply to this folder, so we can
// ignore the current custom gitignore file.
//
if !path.starts_with(gi.path()) {
continue;
}
if !m_explicit.is_none() {
break;
}
m_explicit = gi.matched(&path, is_dir).map(IgnoreMatch::gitignore);
}
let m_global = if any_git {
self.0
.git_global_matcher
.matched(&path, is_dir)
.map(IgnoreMatch::gitignore)
} else {
Match::None
};
// CHANGED: We added logic to configure an order in which the ignore files are respected and
// allowed a whitelist in a later file to overrule a block on an earlier file.
let order = [
// Manually added ignores
&m_explicit,
// .custom-ignore
&m_custom_ignore,
// .ignore
&m_ignore,
// .gitignore
&m_gi,
// .git/info/exclude
&m_gi_exclude,
// Global gitignore
&m_global,
];
for check in order.into_iter() {
if check.is_none() {
continue;
}
return check.clone();
}
m_explicit
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does matched_ignore() do?
matched_ignore() is a function in the tailwindcss codebase.
What does matched_ignore() call?
matched_ignore() calls 4 function(s): absolute_base, matched, parents, path.
What calls matched_ignore()?
matched_ignore() is called by 1 function(s): matched.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free