(
&self,
request: WorkspaceGitCreateWorktreeRequest,
)
| 426 | } |
| 427 | |
| 428 | async fn create_worktree( |
| 429 | &self, |
| 430 | request: WorkspaceGitCreateWorktreeRequest, |
| 431 | ) -> Result<WorkspaceGitWorktreeMutation> { |
| 432 | let branch = request.branch; |
| 433 | let path = request |
| 434 | .path |
| 435 | .map(|path| { |
| 436 | let path = PathBuf::from(path); |
| 437 | if path.is_absolute() { |
| 438 | path |
| 439 | } else { |
| 440 | self.root.join(path) |
| 441 | } |
| 442 | }) |
| 443 | .unwrap_or_else(|| default_local_worktree_path(&self.root, &branch)); |
| 444 | let display_path = path.display().to_string(); |
| 445 | let new_branch = request.new_branch; |
| 446 | let branch_for_git = branch.clone(); |
| 447 | |
| 448 | self.run_blocking_git(move |root| { |
| 449 | crate::git::create_worktree(&root, &branch_for_git, &path, new_branch) |
| 450 | }) |
| 451 | .await?; |
| 452 | |
| 453 | Ok(WorkspaceGitWorktreeMutation { |
| 454 | path: display_path, |
| 455 | branch: Some(branch), |
| 456 | }) |
| 457 | } |
| 458 | |
| 459 | async fn remove_worktree( |
| 460 | &self, |
nothing calls this directly
no test coverage detected