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

Function add_dir_recursive

atomic-cli/src/commands/git/import.rs:688–703  ·  view source on GitHub ↗

Add all vault files

(repo: &Repository, dir: &std::path::Path)

Source from the content-addressed store, hash-verified

686
687 // Add all vault files
688 fn add_dir_recursive(repo: &Repository, dir: &std::path::Path) {
689 if let Ok(entries) = std::fs::read_dir(dir) {
690 for entry in entries.flatten() {
691 let path = entry.path();
692 if path.is_dir() {
693 add_dir_recursive(repo, &path);
694 } else if path.is_file() {
695 if let Ok(rel) = path.strip_prefix(repo.root()) {
696 let rel_str = rel.to_string_lossy().replace('\\', "/");
697 let _ = repo
698 .add(&rel_str, atomic_repository::TrackingOptions::default());
699 }
700 }
701 }
702 }
703 }
704 let vault_dir = repo.vault_dir();
705 if vault_dir.exists() {
706 add_dir_recursive(repo, &vault_dir);

Callers 1

Calls 6

is_dirMethod · 0.80
pathMethod · 0.45
is_fileMethod · 0.45
rootMethod · 0.45
replaceMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected