(dir: &Path)
| 125 | } |
| 126 | |
| 127 | fn find_only_subdir(dir: &Path) -> Result<PathBuf> { |
| 128 | let mut subdirs = vec![]; |
| 129 | |
| 130 | for entry in fs::read_dir(dir)? { |
| 131 | let entry = entry?; |
| 132 | if entry.file_type()?.is_dir() { |
| 133 | subdirs.push(entry.path()); |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | match subdirs.as_slice() { |
| 138 | [] => bail!("Could not find a restored versioned directory under {}", dir.display()), |
| 139 | [only] => Ok(only.clone()), |
| 140 | _ => bail!( |
| 141 | "Expected exactly one restored versioned directory under {}, found {}", |
| 142 | dir.display(), |
| 143 | subdirs.len() |
| 144 | ), |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | fn copy_overlay_dir(src: &Path, dst: &Path) -> Result<()> { |
| 149 | if !src.exists() { |
no test coverage detected
searching dependent graphs…