Working-copy byte snapshot (conversion-policy relevant files only; .git and .atomic excluded).
(&self)
| 347 | /// Working-copy byte snapshot (conversion-policy relevant files only; |
| 348 | /// .git and .atomic excluded). |
| 349 | fn worktree_snapshot(&self) -> String { |
| 350 | let mut snapshot = String::new(); |
| 351 | let mut stack = vec![self.root().to_path_buf()]; |
| 352 | while let Some(directory) = stack.pop() { |
| 353 | for entry in fs::read_dir(&directory).expect("read dir").flatten() { |
| 354 | let path = entry.path(); |
| 355 | let name = path.file_name().and_then(|name| name.to_str()); |
| 356 | if name == Some(".git") || name == Some(".atomic") { |
| 357 | continue; |
| 358 | } |
| 359 | if path.is_dir() { |
| 360 | stack.push(path); |
| 361 | } else if let Ok(bytes) = fs::read(&path) { |
| 362 | snapshot.push_str(&format!( |
| 363 | "{}\t{:?}\n", |
| 364 | path.strip_prefix(self.root()) |
| 365 | .expect("relative path") |
| 366 | .display(), |
| 367 | bytes |
| 368 | )); |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | snapshot |
| 373 | } |
| 374 | |
| 375 | /// The logical state identity used for watcher-off equivalence: the |
| 376 | /// content-derived manifest roots (identical across repositories for |