(repo_root: &Path, view: &str)
| 270 | } |
| 271 | |
| 272 | fn collect_shelved_artifacts(repo_root: &Path, view: &str) -> Vec<String> { |
| 273 | let dot_dir = repo_root.join(".atomic"); |
| 274 | let mut roots = vec![ |
| 275 | // Per-working-copy shelf artifacts take precedence when present. |
| 276 | dot_dir.join("working-copies"), |
| 277 | dot_dir.join("workspaces").join(view), |
| 278 | ]; |
| 279 | let mut output = Vec::new(); |
| 280 | let working_copy_root = roots.remove(0); |
| 281 | // Enumerate every working copy's shelf for this view plus the legacy |
| 282 | // per-view directory, deterministically. |
| 283 | let mut candidates: Vec<PathBuf> = Vec::new(); |
| 284 | if let Ok(entries) = std::fs::read_dir(&working_copy_root) { |
| 285 | for entry in entries.flatten() { |
| 286 | let candidate = entry.path().join("workspaces").join(view); |
| 287 | if candidate.is_dir() { |
| 288 | candidates.push(candidate); |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | let legacy = roots.remove(0); |
| 293 | if legacy.is_dir() { |
| 294 | candidates.push(legacy); |
| 295 | } |
| 296 | candidates.sort(); |
| 297 | for candidate in candidates { |
| 298 | collect_files(&candidate, &candidate, &mut output, 0); |
| 299 | } |
| 300 | output.sort(); |
| 301 | output.dedup(); |
| 302 | output |
| 303 | } |
| 304 | |
| 305 | fn collect_files(base: &Path, directory: &Path, output: &mut Vec<String>, depth: usize) { |
| 306 | if depth > 8 { |
no test coverage detected