Distrust origin/<branch> when prune's fetch fails
A stale remote-tracking ref survives a failed fetch and the next successful --prune deletes it, so it cannot prove a branch's commits survive upstream. Record whether the pruning fetch succeeded and gate the origin/<branch> existence and containment proofs on it; a failed fetch removes the worktree and keeps the branch. Local-object proofs and the merged head SHA are unaffected.
This commit is contained in:
@@ -126,8 +126,8 @@ agentws token
|
||||
| branch has an open PR | keep |
|
||||
| tip contained in `origin/<default>` | remove worktree + local branch |
|
||||
| every commit patch-equivalent to one in `origin/<default>`'s history | remove worktree + local branch |
|
||||
| PR merged **and** HEAD contained in the PR's head commit (or in `origin/<branch>`) | remove worktree + local branch |
|
||||
| PR closed **and** HEAD contained in `origin/<branch>` | remove worktree + local branch |
|
||||
| PR merged **and** HEAD contained in the PR's head commit (or in a verified `origin/<branch>`) | remove worktree + local branch |
|
||||
| PR closed **and** HEAD contained in a verified `origin/<branch>` | remove worktree + local branch |
|
||||
| anything else | remove worktree, keep the branch |
|
||||
|
||||
A branch is deleted only where git proves its commits survive elsewhere. PR
|
||||
@@ -142,6 +142,13 @@ because a merged branch's commits carry different SHAs upstream. It proves the
|
||||
patches reached the default branch's history at some point — a later revert
|
||||
still counts — not that they stand at its tip.
|
||||
|
||||
`origin/<branch>` counts as evidence only when this run's `git fetch --prune`
|
||||
succeeded. A tracking ref left over from an earlier fetch may name a branch that
|
||||
is already gone upstream and is itself due for deletion, so a failed fetch
|
||||
downgrades those verdicts to `remove` and keeps the branch. Proofs that read
|
||||
only local objects — containment in `origin/<default>`, patch equivalence, and
|
||||
containment in a merged PR's head SHA — stand on their own.
|
||||
|
||||
Gitea PR state only adds to the git answer: when it cannot be reached, prune
|
||||
says so and never deletes a branch it could not prove, and a PR listing that
|
||||
hits the pagination cap is reported rather than read as "no PR". Matching a
|
||||
|
||||
Reference in New Issue
Block a user