2.27 Oid
(require libgit2/include/oid) | package: libgit2 |
procedure
(git_oid_cmp a b) → integer?
a : oid? b : oid?
procedure
(git_oid_cpy out src) → integer?
out : oid? src : oid?
procedure
(git_oid_equal a b) → boolean?
a : oid? b : oid?
If N is odd, N-1 characters will be parsed instead. The remaining space in the git_oid will be set to zero.
procedure
(git_oid_iszero id) → boolean?
id : oid?
The resulting string is "aa/...", where "aa" is the first two hex digits of the oid and "..." is the remaining 38 digits.
The OID is expected to be a 40-char hexadecimal string. The OID is owned by the user and will not be modified or freed.
For performance reasons, there is a hard-limit of how many OIDs can be added to a single set (around ~32000, assuming a mostly randomized distribution), which should be enough for any kind of program, and keeps the algorithm fast and memory-efficient.
Attempting to add more than those OIDs will result in a GITERR_INVALID error
procedure
(git_oid_shorten_free os) → void?
os : oid_shorten?
The OID shortener is used to process a list of OIDs in text form and return the shortest length that would uniquely identify all of them.
E.g. look at the result of git log –abbrev.
procedure
(git_oid_tostr out n id) → string?
out : ? n : size_t id : oid?
If the buffer is smaller than GIT_OID_HEXSZ+1, then the resulting oid c-string will be truncated to n-1 characters (but will still be NUL-byte terminated).
If there are any input parameter errors (out == NULL, n == 0, oid == NULL), then a pointer to an empty string is returned, so that the return value can always be printed.
procedure
(git_oid_tostr_s oid) → string?
oid : oid?
The c-string is owned by the library and should not be freed by the user. If libgit2 is built with thread support, the string will be stored in TLS (i.e. one buffer per thread) to allow for concurrent calls of the function.