(repo: &Repository, dir: &std::path::Path)
| 60 | } |
| 61 | |
| 62 | fn add_vault_files_recursive(repo: &Repository, dir: &std::path::Path) -> CliResult<()> { |
| 63 | if let Ok(entries) = std::fs::read_dir(dir) { |
| 64 | for entry in entries.flatten() { |
| 65 | let path = entry.path(); |
| 66 | if path.is_dir() { |
| 67 | add_vault_files_recursive(repo, &path)?; |
| 68 | } else if path.is_file() { |
| 69 | if let Ok(rel) = path.strip_prefix(repo.root()) { |
| 70 | let _ = repo.add(rel, atomic_repository::TrackingOptions::default()); |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | Ok(()) |
| 76 | } |