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

Function add_dir_recursive

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

Add all vault files

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

Source from the content-addressed store, hash-verified

984
985 // Add all vault files
986 fn add_dir_recursive(repo: &Repository, dir: &std::path::Path) {
987 if let Ok(entries) = std::fs::read_dir(dir) {
988 for entry in entries.flatten() {
989 let path = entry.path();
990 if path.is_dir() {
991 add_dir_recursive(repo, &path);
992 } else if path.is_file() {
993 if let Ok(rel) = path.strip_prefix(repo.root()) {
994 let rel_str = rel.to_string_lossy().replace('\\', "/");
995 let _ = repo
996 .add(&rel_str, atomic_repository::TrackingOptions::default());
997 }
998 }
999 }
1000 }
1001 }
1002 let vault_dir = repo.vault_dir();
1003 if vault_dir.exists() {
1004 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