Fix agent reading and editing files over SSH (#30144)

Release Notes:

- Fixed a bug that would prevent the agent from working over SSH.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Richard Feldman <oss@rtfeldman.com>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Cole Miller <m@cole-miller.net>
This commit is contained in:
Antonio Scandurra 2025-05-07 19:07:01 +02:00 committed by GitHub
parent 582ad845b9
commit 89430a019c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 321 additions and 1780 deletions

View file

@ -806,23 +806,6 @@ impl Worktree {
}
}
pub fn file_exists(&self, path: &Path, cx: &Context<Worktree>) -> Task<Result<bool>> {
match self {
Worktree::Local(this) => {
let fs = this.fs.clone();
let path = this.absolutize(path);
cx.background_spawn(async move {
let path = path?;
let metadata = fs.metadata(&path).await?;
Ok(metadata.map_or(false, |metadata| !metadata.is_dir))
})
}
Worktree::Remote(_) => Task::ready(Err(anyhow!(
"remote worktrees can't yet check file existence"
))),
}
}
pub fn load_file(&self, path: &Path, cx: &Context<Worktree>) -> Task<Result<LoadedFile>> {
match self {
Worktree::Local(this) => this.load_file(path, cx),