Function
add_vault_files_recursive
(
repo: &Repository,
working_copy: WorkingCopyId,
dir: &std::path::Path,
)
Source from the content-addressed store, hash-verified
| 74 | } |
| 75 | |
| 76 | fn 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 | } |
Tested by
no test coverage detected