Skip to main content

branch_key

Function branch_key 

Source
pub fn branch_key(name: &str, created_seq: u64) -> String
Expand description

The registry id for one generation of a branch name.

§Why a name is not the key

A branch name is a WORKING LABEL, not an identity, so reusing the name of a merged or abandoned branch is ALLOWED. The argument:

A tag or a root is an identity because outside parties cite it — a release note points at v5.0.1 forever, so rebinding that name rewrites history someone else already recorded. Nothing cites a branch name that way. The things that cite a branch are its own merge record and its own registry entry, and both of those capture base_seq and created_seq, which is the tuple that actually identifies the line of history. fix-pricing merged last March and fix-pricing cut this morning are two different branches that happen to share a label, and refusing the second one buys nothing except a naming ritual — operators would write fix-pricing-2, which is the same reuse with worse ergonomics.

What reuse must NOT cost is auditability. If the registry were keyed by name alone, the second generation’s record would supersede the first in the id index and the first branch would only be reachable through AS OF. So the key is {zero-padded created_seq}@{name}: every generation is its own durable record, chronologically ordered by id, and reuse adds history rather than hiding it.

Reusing the name of an ACTIVE branch is still refused — that is not reuse, that is two live branches answering to one label.