pub struct RepoBranches {
pub names: HashSet<String>,
pub ref_count: usize,
}Expand description
What a repo knows about its branches, in two quantities that must not be confused for each other.
Self::names deliberately over-includes and Self::ref_count is
exact. A caller sparing on membership wants the first; a caller
judging whether the repo can be trusted to answer wants the second.
They were one value once, and the over-inclusion silently inflated
the population: each slash in a branch name adds a phantom suffix, so
release/2.0/rc1 reads as three names against two refs and a shallow
clone looks well-stocked. One slash does not show it - two names, two
refs.
Fields§
§names: HashSet<String>Every name a stored branch might legitimately match. Includes
every /-suffix of a remote-tracking ref’s tail, so it can only
spare a branch, never condemn one - which is why nothing is
dropped from it on a name test. NOT a population.
ref_count: usizeBranch refs the repo actually holds - local heads plus remote-tracking refs, excluding symrefs, which point at another ref in the same listing rather than being branches of their own. Independent of how any branch is named, which is the whole point: a count derived from names moves when a branch is renamed.