Fix ssh project history (#19683)

Use `Fs` instead of `std::fs` and do entry existence checks better:
* first, check the worktree entry existence without any FS checks
* then, only for local cases, use `Fs` to check for abs_path existence
of items, in case those came from single-filed worktrees that got closed
and removed.

Remote entries do not get file existence checks, so might try opening
previously removed buffers for now.

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2024-10-24 21:49:07 +03:00 committed by GitHub
parent 3ec015b325
commit 454d3dd52b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 80 additions and 52 deletions

View file

@ -4,7 +4,7 @@ use super::*;
use editor::Editor;
use gpui::{Entity, TestAppContext, VisualTestContext};
use menu::{Confirm, SelectNext, SelectPrev};
use project::FS_WATCH_LATENCY;
use project::{RemoveOptions, FS_WATCH_LATENCY};
use serde_json::json;
use workspace::{AppState, ToggleFileFinder, Workspace};
@ -1450,6 +1450,15 @@ async fn test_nonexistent_history_items_not_shown(cx: &mut gpui::TestAppContext)
open_close_queried_buffer("non", 1, "nonexistent.rs", &workspace, cx).await;
open_close_queried_buffer("thi", 1, "third.rs", &workspace, cx).await;
open_close_queried_buffer("fir", 1, "first.rs", &workspace, cx).await;
app_state
.fs
.remove_file(
Path::new("/src/test/nonexistent.rs"),
RemoveOptions::default(),
)
.await
.unwrap();
cx.run_until_parked();
let picker = open_file_picker(&workspace, cx);
cx.simulate_input("rs");