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

Method walk_files

atomic-core/src/output/memory.rs:554–580  ·  view source on GitHub ↗
(&self, prefix: &str)

Source from the content-addressed store, hash-verified

552 }
553
554 fn walk_files(&self, prefix: &str) -> Result<Vec<String>, Self::Error> {
555 let files = self.files.borrow();
556 let mut result: Vec<String> = files
557 .iter()
558 .filter(|(path, file)| {
559 // Only include files, not directories
560 if file.metadata.is_dir {
561 return false;
562 }
563 // Skip .atomic directory
564 if path.starts_with(".atomic/") || *path == ".atomic" {
565 return false;
566 }
567 // Filter by prefix if provided
568 if prefix.is_empty() {
569 true
570 } else if prefix.ends_with('/') {
571 path.starts_with(prefix)
572 } else {
573 path.starts_with(&format!("{}/", prefix)) || *path == prefix
574 }
575 })
576 .map(|(path, _)| path.clone())
577 .collect();
578 result.sort();
579 Ok(result)
580 }
581}
582
583impl WorkingCopy for Memory {

Calls 4

sortMethod · 0.80
iterMethod · 0.45
is_emptyMethod · 0.45
cloneMethod · 0.45