windows: Fix FS-related issues (#23369)

I've noticed an occasional error: `ignoring event C:\some\path\to\file
outside of root path \\?\C:\some\path`. This happens because UNC paths
always fail to match with non-UNC paths during operations like
`strip_prefix` or `starts_with`. To address this, I changed the types of
some key parameters to `SanitizedPath`. With this adjustment, FS events
are now correctly identified, and under the changes in this PR, the
`test_rescan_and_remote_updates` test also passes successfully on
Windows.

Release Notes:

- N/A
This commit is contained in:
张小白 2025-01-21 14:19:23 +08:00 committed by GitHub
parent 8f87b5637a
commit 04c04e8406
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 44 additions and 17 deletions

View file

@ -24,7 +24,12 @@ use std::{str::FromStr, sync::OnceLock};
use std::{mem, num::NonZeroU32, ops::Range, task::Poll};
use task::{ResolvedTask, TaskContext};
use unindent::Unindent as _;
use util::{assert_set_eq, paths::PathMatcher, test::temp_tree, TryFutureExt as _};
use util::{
assert_set_eq,
paths::{replace_path_separator, PathMatcher},
test::temp_tree,
TryFutureExt as _,
};
#[gpui::test]
async fn test_block_via_channel(cx: &mut gpui::TestAppContext) {
@ -3265,7 +3270,10 @@ async fn test_rescan_and_remote_updates(cx: &mut gpui::TestAppContext) {
"d",
"d/file3",
"d/file4",
];
]
.into_iter()
.map(replace_path_separator)
.collect::<Vec<_>>();
cx.update(|app| {
assert_eq!(