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:
parent
582ad845b9
commit
89430a019c
31 changed files with 321 additions and 1780 deletions
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue