mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 02:37:21 +00:00
Avoid async fs call before checking if operation is applicable
This way, the executor isn't influenced by operations that aren't applicable.
This commit is contained in:
parent
1064b14779
commit
bf3b8adf35
1 changed files with 8 additions and 11 deletions
|
@ -735,11 +735,13 @@ async fn apply_client_operation(
|
||||||
is_dir,
|
is_dir,
|
||||||
content,
|
content,
|
||||||
} => {
|
} => {
|
||||||
client
|
if !client
|
||||||
.fs
|
.fs
|
||||||
.metadata(&path.parent().unwrap())
|
.directories()
|
||||||
.await?
|
.contains(&path.parent().unwrap().to_owned())
|
||||||
.ok_or(TestError::Inapplicable)?;
|
{
|
||||||
|
return Err(TestError::Inapplicable);
|
||||||
|
}
|
||||||
|
|
||||||
if is_dir {
|
if is_dir {
|
||||||
log::info!("{}: creating dir at {:?}", client.username, path);
|
log::info!("{}: creating dir at {:?}", client.username, path);
|
||||||
|
@ -761,13 +763,8 @@ async fn apply_client_operation(
|
||||||
repo_path,
|
repo_path,
|
||||||
contents,
|
contents,
|
||||||
} => {
|
} => {
|
||||||
if !client
|
if !client.fs.directories().contains(&repo_path) {
|
||||||
.fs
|
return Err(TestError::Inapplicable);
|
||||||
.metadata(&repo_path)
|
|
||||||
.await?
|
|
||||||
.map_or(false, |m| m.is_dir)
|
|
||||||
{
|
|
||||||
Err(TestError::Inapplicable)?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log::info!(
|
log::info!(
|
||||||
|
|
Loading…
Reference in a new issue