MCPcopy Index your code
hub / github.com/AI45Lab/Code / remove_worktree

Function remove_worktree

core/src/git.rs:603–616  ·  view source on GitHub ↗

Remove a worktree.

(repo_path: &Path, path: &Path, force: bool)

Source from the content-addressed store, hash-verified

601
602/// Remove a worktree.
603pub 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.
619pub fn get_diff(repo_path: &Path, target: Option<&str>) -> Result<String> {

Callers 1

remove_worktreeMethod · 0.85

Calls 1

run_gitFunction · 0.85

Tested by

no test coverage detected