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

Function add_vault_files_recursive

libatomic/src/daemon/services_agent.rs:1209–1231  ·  view source on GitHub ↗

The local vault-init body's recursive tracker: add every file under the vault directory (relative to the repository root).

(
    repo: &atomic_repository::Repository,
    working_copy: atomic_core::types::WorkingCopyId,
    dir: &std::path::Path,
)

Source from the content-addressed store, hash-verified

1207/// The local vault-init body's recursive tracker: add every file under
1208/// the vault directory (relative to the repository root).
1209fn add_vault_files_recursive(
1210 repo: &atomic_repository::Repository,
1211 working_copy: atomic_core::types::WorkingCopyId,
1212 dir: &std::path::Path,
1213) -> Result<(), Status> {
1214 if let Ok(entries) = std::fs::read_dir(dir) {
1215 for entry in entries.flatten() {
1216 let path = entry.path();
1217 if path.is_dir() {
1218 add_vault_files_recursive(repo, working_copy, &path)?;
1219 } else if path.is_file() {
1220 if let Ok(relative) = path.strip_prefix(repo.root()) {
1221 let _ = repo.add(
1222 working_copy,
1223 relative,
1224 atomic_repository::TrackingOptions::default(),
1225 );
1226 }
1227 }
1228 }
1229 }
1230 Ok(())
1231}
1232
1233pub(crate) fn response_meta(meta: &Option<RequestMeta>) -> Option<ResponseMeta> {
1234 meta.as_ref().map(|meta| ResponseMeta {

Callers 1

init_vaultMethod · 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