Remove a worktree.
(repo_path: &Path, path: &Path, force: bool)
| 601 | |
| 602 | /// Remove a worktree. |
| 603 | pub fn remove_worktree(repo_path: &Path, path: &Path, force: bool) -> Result<()> { |
| 604 | let path_str = path.display().to_string(); |
| 605 | let args: Vec<&str> = if force { |
| 606 | vec!["worktree", "remove", "--force", &path_str] |
| 607 | } else { |
| 608 | vec!["worktree", "remove", &path_str] |
| 609 | }; |
| 610 | |
| 611 | let (success, _, stderr) = run_git(repo_path, &args)?; |
| 612 | if !success { |
| 613 | return Err(anyhow!("Failed to remove worktree: {}", stderr)); |
| 614 | } |
| 615 | Ok(()) |
| 616 | } |
| 617 | |
| 618 | /// Get diff output. |
| 619 | pub fn get_diff(repo_path: &Path, target: Option<&str>) -> Result<String> { |
no test coverage detected