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

Function add_dir_recursive

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

Add all vault files

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

Source from the content-addressed store, hash-verified

711
712 // Add all vault files
713 fn add_dir_recursive(repo: &Repository, dir: &std::path::Path) {
714 if let Ok(entries) = std::fs::read_dir(dir) {
715 for entry in entries.flatten() {
716 let path = entry.path();
717 if path.is_dir() {
718 add_dir_recursive(repo, &path);
719 } else if path.is_file() {
720 if let Ok(rel) = path.strip_prefix(repo.root()) {
721 let rel_str = rel.to_string_lossy().replace('\\', "/");
722 let _ = repo
723 .add(&rel_str, atomic_repository::TrackingOptions::default());
724 }
725 }
726 }
727 }
728 }
729 let vault_dir = repo.vault_dir();
730 if vault_dir.exists() {
731 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