Expand description
The per-branch push coordination file name: a reversible, flat, case-safe key.
What:
The reversible, flat, case-insensitive-safe file name of one branch’s push coordination files.
Why:
The per-branch push lock and last-pushed record live under <git-common-dir>/cli-git/push/,
and the incumbent (src/auto-push-branch-key.ts) and this wrapper must name them identically,
because both wrappers contend on the same lock while both are installed.
Uppercase letters are escaped too, so refs that differ only in case never share a file
on a case-insensitive filesystem.
In TS you’d write (pseudocode):
encodeBranchKey('refs/heads/Main'); // 'refs%2Fheads%2F%4Dain'Structs§
- Branch
KeyError - What:
A push coordination key that
encode_branch_keynever produces. Why: Decoding a key that the incumbent did not write must stop the caller, never guess a ref name.
Functions§
- decode_
branch_ key - What:
Reverse
encode_branch_keyin one left-to-right pass.Result<A, B>is either the decoded ref name or aBranchKeyError. Why: A key with an unescaped non-verbatim character, a malformed escape, or bytes that are not UTF-8 names no branch and must stop the caller. - encode_
branch_ key - What:
Encode a full ref name as one flat file name component.
&stris borrowed UTF-8 text. Why: Each UTF-8 byte outside the verbatim set becomes%XXwith uppercase hexadecimal digits, so every ref maps to one reversible name.