Fix Windows CI: use ends_with for FakeFs paths, add cfg gate on import

Richard Feldman created

FakeFs on Windows prefixes paths with C:\, so exact path comparisons
in test assertions fail. Use ends_with instead.

Also add missing #[cfg(feature = "test-support")] gate on the
FakeGitRepositoryState import in fs.rs which broke check_docs.

Change summary

crates/fs/src/fs.rs                 | 1 +
crates/sidebar/src/sidebar_tests.rs | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)

Detailed changes

crates/fs/src/fs.rs 🔗

@@ -55,6 +55,7 @@ mod fake_git_repo;
 use collections::{BTreeMap, btree_map};
 #[cfg(feature = "test-support")]
 pub use fake_git_repo::FakeCommitSnapshot;
+#[cfg(feature = "test-support")]
 use fake_git_repo::FakeGitRepositoryState;
 #[cfg(feature = "test-support")]
 use git::{

crates/sidebar/src/sidebar_tests.rs 🔗

@@ -5042,7 +5042,7 @@ async fn test_archive_and_restore_single_worktree(cx: &mut TestAppContext) {
     assert!(
         !fs.directories(false)
             .iter()
-            .any(|p| p == std::path::Path::new("/wt-feature")),
+            .any(|p| p.ends_with("wt-feature")),
         "worktree directory should not exist before restore"
     );
 
@@ -5106,7 +5106,7 @@ async fn test_archive_and_restore_single_worktree(cx: &mut TestAppContext) {
     assert!(
         fs.directories(false)
             .iter()
-            .any(|p| p == std::path::Path::new("/wt-feature")),
+            .any(|p| p.ends_with("wt-feature")),
         "expected worktree directory to be recreated after restore, dirs: {:?}",
         fs.directories(false)
     );