Make add_local_worktree private and use find_or_create_local_worktree
The former always adds a worktree, even if we have one already in the project and that could be misused. The public API should always search for a local worktree containing the requested path first so that the project can uphold invariants about which worktrees it has.
This commit is contained in:
@@ -644,7 +644,7 @@ mod tests {
|
||||
});
|
||||
let (root1, _) = project
|
||||
.update(&mut cx, |project, cx| {
|
||||
project.find_or_create_worktree_for_abs_path("/root1", false, cx)
|
||||
project.find_or_create_local_worktree("/root1", false, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
@@ -653,7 +653,7 @@ mod tests {
|
||||
.await;
|
||||
let (root2, _) = project
|
||||
.update(&mut cx, |project, cx| {
|
||||
project.find_or_create_worktree_for_abs_path("/root2", false, cx)
|
||||
project.find_or_create_local_worktree("/root2", false, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user