Skip to main content

Module branches

Module branches 

Source
Expand description

Local-branch hygiene after squash 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. This module holds the pure half of rk branches prune: parsing what git for-each-ref reports, the guard order that keeps a branch out of the candidate set, and the confirmation predicate that turns a forge answer into proof. Spawning stays in the handler.

Structs§

Branch
One local branch, as git for-each-ref reports it.

Enums§

Class
What the report says about one gone branch.

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 — 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.
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.