MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / PruneWorktrees

Function PruneWorktrees

internal/git/worktree.go:189–196  ·  view source on GitHub ↗

PruneWorktrees runs `git worktree prune` to clean up stale worktree tracking.

(repoDir string)

Source from the content-addressed store, hash-verified

187
188// PruneWorktrees runs `git worktree prune` to clean up stale worktree tracking.
189func PruneWorktrees(repoDir string) error {
190 cmd := exec.Command("git", "worktree", "prune")
191 cmd.Dir = repoDir
192 if out, err := cmd.CombinedOutput(); err != nil {
193 return fmt.Errorf("failed to prune worktrees: %s", strings.TrimSpace(string(out)))
194 }
195 return nil
196}
197
198// DetectOrphanedWorktrees scans .chief/worktrees/ and returns a map of PRD name -> absolute worktree path
199// for worktrees that exist on disk. The caller is responsible for determining which are orphaned

Callers 2

NewAppWithOptionsFunction · 0.92
TestPruneWorktreesFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestPruneWorktreesFunction · 0.68