MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / remove_worktree

Function remove_worktree

crates/opencode-server/src/worktree.rs:174–190  ·  view source on GitHub ↗
(
    repo_path: &Path,
    worktree_path: &str,
    force: bool,
)

Source from the content-addressed store, hash-verified

172}
173
174pub fn remove_worktree(
175 repo_path: &Path,
176 worktree_path: &str,
177 force: bool,
178) -> Result<(), WorktreeError> {
179 if !is_git_repo(repo_path) {
180 return Err(WorktreeError::NotGitRepo);
181 }
182
183 let mut args = vec!["worktree", "remove", worktree_path];
184 if force {
185 args.push("--force");
186 }
187
188 run_git(&args, repo_path)?;
189 Ok(())
190}
191
192pub fn prune_worktrees(repo_path: &Path) -> Result<(), WorktreeError> {
193 if !is_git_repo(repo_path) {

Callers

nothing calls this directly

Calls 2

is_git_repoFunction · 0.85
run_gitFunction · 0.85

Tested by

no test coverage detected