MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / should_ignore_with_rules

Function should_ignore_with_rules

atomic-repository/src/tracking/helpers.rs:131–161  ·  view source on GitHub ↗

Check if a path should be ignored during tracking, with optional ignore rules. This is the full version that accepts optional [`IgnoreRules`] for pattern matching. # Arguments `path` - Path to check (relative to repository root) `include_hidden` - Whether to include hidden files (starting with '.') `is_dir` - Whether the path is a directory `rules` - Optional ignore rules from `.atomicignore` f

(
    path: &Path,
    include_hidden: bool,
    is_dir: bool,
    rules: Option<&IgnoreRules>,
)

Source from the content-addressed store, hash-verified

129///
130/// `true` if the path should be ignored, `false` otherwise.
131pub fn should_ignore_with_rules(
132 path: &Path,
133 include_hidden: bool,
134 is_dir: bool,
135 rules: Option<&IgnoreRules>,
136) -> bool {
137 // Always ignore internal directories
138 if is_always_ignored(path) {
139 return true;
140 }
141
142 // Check ignore rules if provided
143 if let Some(rules) = rules {
144 if rules.is_ignored(path, is_dir) {
145 return true;
146 }
147 }
148
149 // Check for hidden files
150 if !include_hidden {
151 if let Some(name) = path.file_name() {
152 if let Some(name_str) = name.to_str() {
153 if name_str.starts_with('.') {
154 return true;
155 }
156 }
157 }
158 }
159
160 false
161}
162
163/// Collect all files in a directory for tracking.
164///

Callers 4

addMethod · 0.85
add_directoryMethod · 0.85
should_ignoreFunction · 0.85

Calls 3

is_always_ignoredFunction · 0.85
file_nameMethod · 0.80
is_ignoredMethod · 0.45

Tested by

no test coverage detected