libgit2

git_odb_read_header

Version:

Read the header of an object from the database, without reading its full contents.

The header includes the length and the type of an object.

Note that most backends do not support reading only the header of an object, so the whole object will be read and then the header will be returned.

Signature

int git_odb_read_header(size_t *len_out, git_object_t *type_out, git_odb *db, const git_oid *id);

Parameters

size_t *
Out
len_out

pointer where to store the length

Out
type_out

pointer where to store the type

In
db

database to search for the object in.

In
id

identity of the object to read.

Returns

int

0 if the object was read, GIT_ENOTFOUND if the object is not in the database.

Versions