libgit2

git_object_peel

Version:

Recursively peel an object until an object of the specified type is met.

The retrieved peeled object is owned by the repository and should be closed with the git_object_free method.

If you pass GIT_OBJ_ANY as the target type, then the object will be peeled until the type changes (e.g. a tag will be chased until the referenced object is no longer a tag).

Signature

int git_object_peel(git_object **peeled, const git_object *object, git_otype target_type);

Parameters

In
peeled

Pointer to the peeled git_object

In
object

The object to be processed

In
target_type

The type of the requested object (GIT_OBJ_COMMIT, GIT_OBJ_TAG, GIT_OBJ_TREE, GIT_OBJ_BLOB or GIT_OBJ_ANY).

Returns

int

0 on success, GIT_EAMBIGUOUS, GIT_ENOTFOUND or an error code

Versions