pinwheel: Prune deleted worktrees in wt sync

A worktree whose directory was deleted by hand stays registered in git,
so `wt sync` ran `gt restack` in a directory that no longer existed and
reported the worktree as failed. It now runs `git worktree prune` before
going through the worktrees, which drops only entries whose directory
is gone.
This commit is contained in:
Alexander Heldt committed 2026-11-24 17:29:46 +01:00
1 parent 5207e3e227
commit 5d51af4189
1 file changed
+1
+1
View File
@@ -40,6 +40,7 @@ wt() {
;; ;;
sync) sync)
gt --cwd "$primary" sync "${@:2}" || return gt --cwd "$primary" sync "${@:2}" || return
git -C "$primary" worktree prune
local line branch merged failed=() local line branch merged failed=()
merged=(${(f)"$(jq -r '.prInfos[] | select(.state == "MERGED") | .headRefName' \ merged=(${(f)"$(jq -r '.prInfos[] | select(.state == "MERGED") | .headRefName' \
"$primary/.git/.graphite_pr_info" 2>/dev/null)"}) "$primary/.git/.graphite_pr_info" 2>/dev/null)"})