Skip to main content

insert_subtree

Function insert_subtree 

Source
pub fn insert_subtree(subtrees: &mut Vec<PathBuf>, path: PathBuf)
Expand description

Insert path into a set of “subtree” grants, keeping the set minimal.

A subtree grant covers a path and all of its descendants. Insertion is a no-op when path is already covered by an existing (equal-or-broader) entry; otherwise path is added and any now-subsumed descendant entries are pruned. Containment is purely lexical (component-wise starts_with), so callers should normalize paths (e.g. via normalize_lexically) before inserting, otherwise .. components can defeat the containment checks.