MCPcopy Index your code
hub / github.com/github/git-sizer / OIDFromBytes

Function OIDFromBytes

git/oid.go:19–26  ·  view source on GitHub ↗

OIDFromBytes converts a byte slice containing an object ID in binary format into an `OID`.

(oidBytes []byte)

Source from the content-addressed store, hash-verified

17// OIDFromBytes converts a byte slice containing an object ID in
18// binary format into an `OID`.
19func OIDFromBytes(oidBytes []byte) (OID, error) {
20 var oid OID
21 if len(oidBytes) != len(oid.v) {
22 return OID{}, errors.New("bytes oid has the wrong length")
23 }
24 copy(oid.v[0:20], oidBytes)
25 return oid, nil
26}
27
28// NewOID converts an object ID in hex format (i.e., `[0-9a-f]{40}`)
29// into an `OID`.

Callers 1

NewOIDFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected