add_parents() — tailwindcss Function Reference
Architecture documentation for the add_parents() function in dir.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 6ce8c6d0_aa87_a200_fbf4_912453c675b1["add_parents()"] e48edf9e_79c8_133f_02eb_a690a44f3fe9["absolute_parent()"] e48edf9e_79c8_133f_02eb_a690a44f3fe9 -->|calls| 6ce8c6d0_aa87_a200_fbf4_912453c675b1 f3d38e16_75f1_ce44_5cde_d03512706727["absolute_parent_anchored()"] f3d38e16_75f1_ce44_5cde_d03512706727 -->|calls| 6ce8c6d0_aa87_a200_fbf4_912453c675b1 07e1fb9f_f87a_3d4a_996d_bd4a0f4cb52d["is_root()"] 6ce8c6d0_aa87_a200_fbf4_912453c675b1 -->|calls| 07e1fb9f_f87a_3d4a_996d_bd4a0f4cb52d d1089cef_9796_eaf7_4226_2ddf9f044d89["parent()"] 6ce8c6d0_aa87_a200_fbf4_912453c675b1 -->|calls| d1089cef_9796_eaf7_4226_2ddf9f044d89 00fde01e_208e_84d9_5445_fec3bcf2125f["add_child_path()"] 6ce8c6d0_aa87_a200_fbf4_912453c675b1 -->|calls| 00fde01e_208e_84d9_5445_fec3bcf2125f style 6ce8c6d0_aa87_a200_fbf4_912453c675b1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
crates/ignore/src/dir.rs lines 178–233
pub(crate) fn add_parents<P: AsRef<Path>>(&self, path: P) -> (Ignore, Option<Error>) {
if !self.0.opts.parents
&& !self.0.opts.git_ignore
&& !self.0.opts.git_exclude
&& !self.0.opts.git_global
{
// If we never need info from parent directories, then don't do
// anything.
return (self.clone(), None);
}
if !self.is_root() {
panic!("Ignore::add_parents called on non-root matcher");
}
// CHANGED: Use `dunce::canonicalize` as we use it everywhere else.
let absolute_base = match dunce::canonicalize(path.as_ref()) {
Ok(path) => Arc::new(path),
Err(_) => {
// There's not much we can do here, so just return our
// existing matcher. We drop the error to be consistent
// with our general pattern of ignoring I/O errors when
// processing ignore files.
return (self.clone(), None);
}
};
// List of parents, from child to root.
let mut parents = vec![];
let mut path = &**absolute_base;
while let Some(parent) = path.parent() {
parents.push(parent);
path = parent;
}
let mut errs = PartialErrorBuilder::default();
let mut ig = self.clone();
for parent in parents.into_iter().rev() {
let mut compiled = self.0.compiled.write().unwrap();
if let Some(weak) = compiled.get(parent.as_os_str()) {
if let Some(prebuilt) = weak.upgrade() {
ig = Ignore(prebuilt);
continue;
}
}
let (mut igtmp, err) = ig.add_child_path(parent);
errs.maybe_push(err);
igtmp.is_absolute_parent = true;
igtmp.absolute_base = Some(absolute_base.clone());
igtmp.has_git = if self.0.opts.require_git && self.0.opts.git_ignore {
parent.join(".git").exists() || parent.join(".jj").exists()
} else {
false
};
let ig_arc = Arc::new(igtmp);
ig = Ignore(ig_arc.clone());
compiled.insert(parent.as_os_str().to_os_string(), Arc::downgrade(&ig_arc));
}
(ig, errs.into_error_option())
}
Domain
Subdomains
Source
Frequently Asked Questions
What does add_parents() do?
add_parents() is a function in the tailwindcss codebase.
What does add_parents() call?
add_parents() calls 3 function(s): add_child_path, is_root, parent.
What calls add_parents()?
add_parents() is called by 2 function(s): absolute_parent, absolute_parent_anchored.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free