MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / is_ignored

Function is_ignored

crates/openshell-bootstrap/src/build.rs:370–385  ·  view source on GitHub ↗

Check whether a relative path should be ignored based on `.dockerignore` patterns. Uses a simple glob-matching approach: patterns are matched against the full relative path. A leading `/` anchors to the context root. The last matching pattern wins (negation patterns re-include files).

(relative_path: &str, is_dir: bool, patterns: &[IgnorePattern])

Source from the content-addressed store, hash-verified

368/// full relative path. A leading `/` anchors to the context root. The last
369/// matching pattern wins (negation patterns re-include files).
370fn is_ignored(relative_path: &str, is_dir: bool, patterns: &[IgnorePattern]) -> bool {
371 let mut ignored = false;
372
373 for pat in patterns {
374 let pattern = pat.pattern.trim_start_matches('/');
375
376 // Check if the pattern matches.
377 let matches = glob_match(pattern, relative_path, is_dir);
378
379 if matches {
380 ignored = !pat.negated;
381 }
382 }
383
384 ignored
385}
386
387/// Simple glob matching supporting `*`, `**`, and `?`.
388///

Callers 1

walk_and_addFunction · 0.85

Calls 1

glob_matchFunction · 0.85

Tested by

no test coverage detected