Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion cmd/ccw/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ func runPicker(mainRepo string, passthrough []string, interactive bool) int {
case picker.ActionResume:
return runResume(sel, passthrough)
case picker.ActionDelete:
if sel.IsPrunable {
if err := worktree.Prune(mainRepo); err != nil {
ui.Error("%v", err)
return 1
}
ui.Success("Pruned worktree admin files")
continue
}
if err := worktree.Remove(mainRepo, sel.Path, sel.ForceDelete); err != nil {
ui.Error("%v", err)
return 1
Expand Down Expand Up @@ -161,6 +169,14 @@ func applyBulkDelete(mainRepo string, bulk picker.BulkDeletion) int {
}
ui.Success("Removed %s", p)
}
if bulk.RunPrune {
if err := worktree.Prune(mainRepo); err != nil {
ui.Error("prune: %v", err)
errs++
} else {
ui.Success("Pruned worktree admin files")
}
}
if errs > 0 {
return 1
}
Expand Down Expand Up @@ -216,7 +232,12 @@ func runCleanAll(mainRepo string, flags cli.Flags, interactive bool) int {
Force: flags.Force,
}
for _, i := range targets {
bulk.Paths = append(bulk.Paths, infos[i].Path)
w := infos[i]
if w.Status == worktree.StatusPrunable {
bulk.RunPrune = true
continue
}
bulk.Paths = append(bulk.Paths, w.Path)
}
return applyBulkDelete(mainRepo, bulk)
}
Expand Down
Loading