pub fn branch_ref_exists(repo: &Path, branch: &str) -> boolExpand description
Whether branch resolves at repo, as a local head or as any
remote-tracking ref. A repo git cannot read answers true, so a
caller cleaning up on absence never discards state it failed to
inspect.
Membership in repo_branch_names rather than a targeted
for-each-ref pattern, so both callers share one parser. A pattern
cannot answer this safely on a delete path: refs/remotes/*/<branch>
has a * that does not cross /, so a remote named gh/upstream
puts its refs where the pattern cannot see them, and a[b, a leading
- or a space match nothing. Every one of those exits 0 with empty
stdout, and empty is what triggers the delete.
Remote-tracking refs count because reap_worktree_branch deletes a
local head whose commits are reachable from one, and a branch that
survives on a remote is still open for review.