Don't eagerly populate copied subdirectory

This can race anyway with snapshot updates, so we just eagerly refresh
the root entry and wait for updates to come in to populate it.
This commit is contained in:
Antonio Scandurra 2022-05-31 08:11:07 +02:00
parent 604b737d7c
commit 354488ebdf
5 changed files with 43 additions and 126 deletions

View file

@ -824,7 +824,7 @@ async fn test_fs_operations(
project_b
.update(cx_b, |project, cx| {
project
.copy_entry(dir_entry.id, Path::new("DIR2"), cx)
.copy_entry(entry.id, Path::new("f.txt"), cx)
.unwrap()
})
.await
@ -840,13 +840,10 @@ async fn test_fs_operations(
"DIR/SUBDIR",
"DIR/SUBDIR/f.txt",
"DIR/e.txt",
"DIR2",
"DIR2/SUBDIR",
"DIR2/SUBDIR/f.txt",
"DIR2/e.txt",
"a.txt",
"b.txt",
"d.txt"
"d.txt",
"f.txt"
]
);
});
@ -861,13 +858,10 @@ async fn test_fs_operations(
"DIR/SUBDIR",
"DIR/SUBDIR/f.txt",
"DIR/e.txt",
"DIR2",
"DIR2/SUBDIR",
"DIR2/SUBDIR/f.txt",
"DIR2/e.txt",
"a.txt",
"b.txt",
"d.txt"
"d.txt",
"f.txt"
]
);
});
@ -884,15 +878,7 @@ async fn test_fs_operations(
.paths()
.map(|p| p.to_string_lossy())
.collect::<Vec<_>>(),
[
"DIR2",
"DIR2/SUBDIR",
"DIR2/SUBDIR/f.txt",
"DIR2/e.txt",
"a.txt",
"b.txt",
"d.txt"
]
["a.txt", "b.txt", "d.txt", "f.txt"]
);
});
worktree_b.read_with(cx_b, |worktree, _| {
@ -901,15 +887,7 @@ async fn test_fs_operations(
.paths()
.map(|p| p.to_string_lossy())
.collect::<Vec<_>>(),
[
"DIR2",
"DIR2/SUBDIR",
"DIR2/SUBDIR/f.txt",
"DIR2/e.txt",
"a.txt",
"b.txt",
"d.txt"
]
["a.txt", "b.txt", "d.txt", "f.txt"]
);
});
@ -925,14 +903,7 @@ async fn test_fs_operations(
.paths()
.map(|p| p.to_string_lossy())
.collect::<Vec<_>>(),
[
"DIR2",
"DIR2/SUBDIR",
"DIR2/SUBDIR/f.txt",
"DIR2/e.txt",
"a.txt",
"b.txt"
]
["a.txt", "b.txt", "f.txt"]
);
});
worktree_b.read_with(cx_b, |worktree, _| {
@ -941,14 +912,7 @@ async fn test_fs_operations(
.paths()
.map(|p| p.to_string_lossy())
.collect::<Vec<_>>(),
[
"DIR2",
"DIR2/SUBDIR",
"DIR2/SUBDIR/f.txt",
"DIR2/e.txt",
"a.txt",
"b.txt"
]
["a.txt", "b.txt", "f.txt"]
);
});
}