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

Method debug_match

atomic-repository/src/ignore.rs:286–317  ·  view source on GitHub ↗

Debug method: check why a path matches or doesn't match. Returns a string describing the match result for debugging.

(&self, path: &Path, is_dir: bool)

Source from the content-addressed store, hash-verified

284 ///
285 /// Returns a string describing the match result for debugging.
286 pub fn debug_match(&self, path: &Path, is_dir: bool) -> String {
287 let mut result = format!("Checking path: {:?}, is_dir: {}\n", path.display(), is_dir);
288
289 result.push_str(&format!(
290 "Local rules loaded: {}, pattern count: {}\n",
291 self.local.is_some(),
292 self.local_pattern_count()
293 ));
294
295 if let Some(ref local) = self.local {
296 let matched = local.matched_path_or_any_parents(path, is_dir);
297 result.push_str(&format!("Local match result: {:?}\n", matched));
298 }
299
300 result.push_str(&format!(
301 "Global rules loaded: {}, pattern count: {}\n",
302 self.global.is_some(),
303 self.global_pattern_count()
304 ));
305
306 if let Some(ref global) = self.global {
307 let matched = global.matched_path_or_any_parents(path, is_dir);
308 result.push_str(&format!("Global match result: {:?}\n", matched));
309 }
310
311 result.push_str(&format!(
312 "Final is_ignored: {}\n",
313 self.is_ignored(path, is_dir)
314 ));
315
316 result
317 }
318}
319
320impl Default for IgnoreRules {

Callers 1

Calls

no outgoing calls

Tested by 1