The window guard's walk skipped no dot-directory, so a scratch clone spoke for the tree
Browse files at this commit308fc77328d755b15c5dce5bb69c265888e017b9Parent: 2c809fd- fix
- the window guard's walk skipped no dot-directory, so a scratch clone spoke for the tree
1 changed file +21 -4
- crates/engine/src/project.rs +21 -4
crates/engine/src/project.rsmodified+21 -4
| @@ -11158,7 +11158,8 @@ mod tests { | |||
| 11158 | /// are cut. A test cannot produce a file a user loses, so the line is | 11158 | /// are cut. A test cannot produce a file a user loses, so the line is |
| 11159 | /// drawn there deliberately, not by omission. | 11159 | /// drawn there deliberately, not by omission. |
| 11160 | /// 4. **A file the walk does not reach**: a path outside `crates/`, or one | 11160 | /// 4. **A file the walk does not reach**: a path outside `crates/`, or one |
| 11161 | - /// under a directory named `target`, `.git` or `vendor`. | 11161 | + /// under a directory named `target`, `.git`, `vendor`, or any |
| 11162 | + /// dot-directory (`.delta/` holds scratch clones of other checkouts). | ||
| 11162 | /// | 11163 | /// |
| 11163 | /// What the matcher DOES now cover, after four rounds of it not doing so: | 11164 | /// What the matcher DOES now cover, after four rounds of it not doing so: |
| 11164 | /// every assignment operator; struct-literal fields and the shorthand form, | 11165 | /// every assignment operator; struct-literal fields and the shorthand form, |
| @@ -11370,9 +11371,25 @@ mod tests { | |||
| 11370 | let path = entry.path(); | 11371 | let path = entry.path(); |
| 11371 | if path.is_dir() { | 11372 | if path.is_dir() { |
| 11372 | // `target` is not source and `vendor` is not ours to rule on. | 11373 | // `target` is not source and `vendor` is not ours to rule on. |
| 11373 | - let skip = path | 11374 | + // |
| 11374 | - .file_name() | 11375 | + // Every DOT-directory, for the same reason and one more: a |
| 11375 | - .is_some_and(|n| n == "target" || n == ".git" || n == "vendor"); | 11376 | + // dot-dir is by convention not part of the tree we are |
| 11377 | + // making claims about. This workspace root holds `.delta/`, | ||
| 11378 | + // a scratch area of clones and worktrees left by delta/A-B | ||
| 11379 | + // tooling, and the walk used to descend into it and report | ||
| 11380 | + // the ten window writes inside a checkout that is not this | ||
| 11381 | + // one -- so the guard was RED here for a file nobody edits, | ||
| 11382 | + // and, worse, VACUOUS about its own tree: the same stale | ||
| 11383 | + // clone that produced the noise could have hidden a real | ||
| 11384 | + // offender behind it, and the floor below was being met in | ||
| 11385 | + // part by lines this guard has no business reading. Skipping | ||
| 11386 | + // the whole class rather than naming `.delta` is the point: | ||
| 11387 | + // the next scratch dir a tool drops here is skipped too. | ||
| 11388 | + let name = path.file_name().unwrap_or_default().to_string_lossy(); | ||
| 11389 | + let skip = name == "target" | ||
| 11390 | + || name == ".git" | ||
| 11391 | + || name == "vendor" | ||
| 11392 | + || name.starts_with('.'); | ||
| 11376 | if !skip { | 11393 | if !skip { |
| 11377 | stack.push(path); | 11394 | stack.push(path); |
| 11378 | } | 11395 | } |