Skip to content

Commit a6d4d1b

Browse files
branchseerclaude
andcommitted
refactor: skip duplicate glob entries via entry API, error on non-UTF-8 paths
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5a4a707 commit a6d4d1b

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

crates/vite_task/src/session/execute/glob_inputs.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,21 @@ fn collect_walk_entries(
4848
let path = entry.path();
4949

5050
// Compute path relative to workspace_root for the result
51-
let Some(relative_to_workspace) = path
52-
.strip_prefix(workspace_root.as_path())
53-
.ok()
54-
.and_then(|p| RelativePathBuf::new(p).ok())
55-
else {
51+
let Some(stripped) = path.strip_prefix(workspace_root.as_path()).ok() else {
5652
continue; // Skip if path is outside workspace_root
5753
};
54+
let relative_to_workspace = RelativePathBuf::new(stripped)?;
55+
56+
let std::collections::btree_map::Entry::Vacant(vacant) =
57+
result.entry(relative_to_workspace)
58+
else {
59+
continue; // Already hashed by a previous glob pattern
60+
};
5861

5962
// Hash file content
6063
match hash_file_content(path) {
6164
Ok(hash) => {
62-
result.insert(relative_to_workspace, hash);
65+
vacant.insert(hash);
6366
}
6467
Err(err) if err.kind() == io::ErrorKind::NotFound => {
6568
// File was deleted between walk and hash, skip it

0 commit comments

Comments
 (0)