Expand description
Local-branch hygiene after merges.
A squash merge rewrites the branch’s work into one trunk commit, so the
branch tip never becomes an ancestor of the trunk and git’s own
--merged test cannot see the merge. Once the forge deletes the remote
branch and a pruning fetch drops the tracking ref, [gone] is the one
local signal left — and it proves only that the upstream vanished,
never that it merged. A merge that keeps the commits — a local rebase
integration, a fast-forward merge, a hand git merge --ff-only —
leaves the tip on the trunk, and the branch’s own reflog says whether
the tip is work or only where the branch was created. This module
holds the pure half of rk branches prune: parsing what
git for-each-ref and the reflog report, the guard order that keeps a
branch out of the candidate set, and the confirmation predicates that
turn a forge answer or a reachable tip into proof. Spawning stays in
the handler and in crate::maintenance.
Structs§
- Branch
- One local branch, as
git for-each-refreports it.
Enums§
Constants§
- FOR_
EACH_ REF_ FORMAT - The
--formatstring the handler passes togit for-each-ref, one tab-separated line per local branch. - PROTECTED_
PREFIX - The prefix naming a release line; a branch under it is never a candidate, whatever its upstream says.
Functions§
- classify
- Classify one branch:
Nonewhen its upstream is live or unset and no local proof covers it — the branch never reaches the report — and the guard’s verdict otherwise. - confirmation
- Judge one forge answer against one tip: only a merged request whose recorded head equals the local tip confirms, because a squash merge destroys the ancestry every other proof would rest on.
- creation_
entry - The commit a branch’s latest creation entry names, from the raw reflog
text git keeps for the ref: one
<old> <new> <identity>\t<message>line per update, oldest first. - merged_
request_ for - Ask the forge for the requests carrying one commit and judge the answer.
- parse_
branches - Parse the tab-separated
for-each-refoutput into branches, skipping any line that does not carry all five fields. - reachable_
tip - The third proof, judged: the trunk reaches
tip, and the branch’s creation entry names a commit other thantip.