Skip to main content

Module branches

Module branches 

Source
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-ref reports it.

Enums§

Class
What the report says about one gone branch.
Proof
What authorized a branch’s retirement.

Constants§

FOR_EACH_REF_FORMAT
The --format string the handler passes to git 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: None when 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-ref output 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 than tip.