libgit2

git_oid_from_prefix

Version:

Parse the given number of characters out of a hex formatted object id string into a git_oid.

The given length can be between 0 and the hex size for the given object ID type - 40 characters for SHA1, 64 characters for SHA256. The remainder of the git_oid will be set to zeros.

Signature

int git_oid_from_prefix(git_oid *out, const char *str, size_t len, git_oid_t type);

Parameters

In
out

oid structure the result is written into.

const char *
In
str

input hex prefix

size_t
In
len

the length of the given prefix

In
type

object id type

Returns

int

0 or an error code

Versions