pub fn parse_object_id(bytes: &[u8]) -> Option<ObjectId>Expand description
What:
Accept bytes as an object name only when they are exactly 40 or 64 lowercase
hexadecimal digits.
&[u8] borrows bytes;
Option<ObjectId> is “a name or nothing”.
Why:
Everything Git prints as an object name passes;
anything else (abbreviations,
revision expressions,
text containing a line feed) is refused before it can
reach the reader’s request stream.
In TS you’d write (pseudocode):
function parseObjectId(bytes: Uint8Array): ObjectId | undefined;