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

Function add_dir_recursive

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

Add all vault files

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

Source from the content-addressed store, hash-verified

795
796 // Add all vault files
797 fn add_dir_recursive(repo: &Repository, dir: &std::path::Path) {
798 if let Ok(entries) = std::fs::read_dir(dir) {
799 for entry in entries.flatten() {
800 let path = entry.path();
801 if path.is_dir() {
802 add_dir_recursive(repo, &path);
803 } else if path.is_file() {
804 if let Ok(rel) = path.strip_prefix(repo.root()) {
805 let rel_str = rel.to_string_lossy().replace('\\', "/");
806 let _ = repo
807 .add(&rel_str, atomic_repository::TrackingOptions::default());
808 }
809 }
810 }
811 }
812 }
813 let vault_dir = repo.vault_dir();
814 if vault_dir.exists() {
815 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