libgit2

git_oid_tostr

Version:

Format a git_oid into a buffer as a hex format c-string.

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.

Signature

char *git_oid_tostr(char *out, size_t n, const git_oid *id);

Parameters

char *
In
out

the buffer into which the oid string is output.

size_t
In
n

the size of the out buffer.

In
id

the oid structure to format.

Returns

char *

the out buffer pointer, assuming no input parameter errors, otherwise a pointer to an empty string.

Versions