libgit2

git_object_short_id

Version:

Get a short abbreviated OID string for the object

This starts at the "core.abbrev" length (default 7 characters) and iteratively extends to a longer string if that length is ambiguous. The result will be unambiguous (at least until new objects are added to the repository).

Signature

int git_object_short_id(git_buf *out, const git_object *obj);

Parameters

In
out

Buffer to write string into

In
obj

The object to get an ID for

Returns

int

0 on success, < 0 for error

Versions