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

Function add_vault_files_recursive

atomic-cli/src/commands/vault/init.rs:76–98  ·  view source on GitHub ↗
(
    repo: &Repository,
    working_copy: WorkingCopyId,
    dir: &std::path::Path,
)

Source from the content-addressed store, hash-verified

74}
75
76fn add_vault_files_recursive(
77 repo: &Repository,
78 working_copy: WorkingCopyId,
79 dir: &std::path::Path,
80) -> CliResult<()> {
81 if let Ok(entries) = std::fs::read_dir(dir) {
82 for entry in entries.flatten() {
83 let path = entry.path();
84 if path.is_dir() {
85 add_vault_files_recursive(repo, working_copy, &path)?;
86 } else if path.is_file() {
87 if let Ok(rel) = path.strip_prefix(repo.root()) {
88 let _ = repo.add(
89 working_copy,
90 rel,
91 atomic_repository::TrackingOptions::default(),
92 );
93 }
94 }
95 }
96 }
97 Ok(())
98}

Callers 1

runMethod · 0.70

Calls 5

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

Tested by

no test coverage detected