Add task summaries, closed-task search and a summary turn before discard
This commit is contained in:
+13
-1
@@ -7,6 +7,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
@@ -84,11 +85,22 @@ func RemoveDetachedWorktree(repo, path string) error {
|
||||
}
|
||||
|
||||
func RemoveWorktree(repo, path, branch string) error {
|
||||
_, err := run(repo, "worktree", "remove", "--force", path)
|
||||
list, err := run(repo, "worktree", "list", "--porcelain")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, statErr := os.Stat(path)
|
||||
if statErr == nil || slices.Contains(strings.Split(list, "\n"), "worktree "+path) {
|
||||
_, err = run(repo, "worktree", "remove", "--force", path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
_, _, code, err := runCode(repo, nil, "rev-parse", "--verify", "--quiet", "refs/heads/"+branch)
|
||||
if err != nil || code != 0 {
|
||||
return err
|
||||
}
|
||||
_, err = run(repo, "branch", "-D", branch)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user