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:
parent
622aff3be2
commit
31dfd01fda
7 changed files with 98 additions and 79 deletions
|
@ -245,7 +245,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(&mut cx, |project, cx| {
|
||||
project.find_or_create_worktree_for_abs_path(Path::new("/root"), false, cx)
|
||||
project.find_or_create_local_worktree("/root", false, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -358,7 +358,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(&mut cx, |project, cx| {
|
||||
project.find_or_create_worktree_for_abs_path(Path::new("/dir1"), false, cx)
|
||||
project.find_or_create_local_worktree("/dir1", false, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -425,7 +425,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(&mut cx, |project, cx| {
|
||||
project.find_or_create_worktree_for_abs_path(Path::new("/root"), false, cx)
|
||||
project.find_or_create_local_worktree("/root", false, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -474,7 +474,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(&mut cx, |project, cx| {
|
||||
project.find_or_create_worktree_for_abs_path(Path::new("/root"), false, cx)
|
||||
project.find_or_create_local_worktree("/root", false, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -626,7 +626,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(&mut cx, |project, cx| {
|
||||
project.find_or_create_worktree_for_abs_path(Path::new("/root"), false, cx)
|
||||
project.find_or_create_local_worktree("/root", false, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
@ -689,7 +689,7 @@ mod tests {
|
|||
params
|
||||
.project
|
||||
.update(&mut cx, |project, cx| {
|
||||
project.find_or_create_worktree_for_abs_path(Path::new("/root"), false, cx)
|
||||
project.find_or_create_local_worktree("/root", false, cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue