Delete every physical file under `root` except `.git`/`.atomic`, so any subsequent content read can only come from the recorded graph.
(root: &Path)
| 112 | /// Delete every physical file under `root` except `.git`/`.atomic`, so any |
| 113 | /// subsequent content read can only come from the recorded graph. |
| 114 | fn clear_worktree(root: &Path) { |
| 115 | for entry in fs::read_dir(root).unwrap() { |
| 116 | let entry = entry.unwrap(); |
| 117 | let name = entry.file_name(); |
| 118 | let name = name.to_string_lossy(); |
| 119 | if name == ".git" || name == ".atomic" || name == ".vault" { |
| 120 | continue; |
| 121 | } |
| 122 | let path = entry.path(); |
| 123 | if path.is_dir() { |
| 124 | fs::remove_dir_all(&path).unwrap(); |
| 125 | } else { |
| 126 | fs::remove_file(&path).unwrap(); |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | /// Export a set of paths from the recorded graph and return the bytes. |
| 132 | fn graph_export(root: &Path, view: &str, paths: &[&str]) -> (Vec<(String, Vec<u8>)>, Duration) { |
no test coverage detected