libgit2

git_reference_foreach

Version:

Perform an operation on each reference in the repository

The processed references may be filtered by type, or using a bitwise OR of several types. Use the magic value GIT_REF_LISTALL to obtain all references, including packed ones.

The callback function will be called for each of the references in the repository, and will receive the name of the reference and the payload value passed to this method.

Signature

int git_reference_foreach(git_repository *repo, unsigned int list_flags, int (*)(const char *, void *) callback, void *payload);

Parameters

In
repo

Repository where to find the refs

unsigned int
In
list_flags

Filtering flags for the reference listing.

int (*)(const char *, void *)
In
callback

Function which will be called for every listed ref

void *
In
payload

Additional data to pass to the callback

Returns

int

GIT_SUCCESS or an error code

Versions