libgit2

git_submodule_foreach

Version:

Iterate over all tracked submodules of a repository.

See the note on git_submodule above. This iterates over the tracked submodules as described therein.

If you are concerned about items in the working directory that look like submodules but are not tracked, the diff API will generate a diff record for workdir items that look like submodules but are not tracked, showing them as added in the workdir. Also, the status API will treat the entire subdirectory of a contained git repo as a single GIT_STATUS_WT_NEW item.

Signature

int git_submodule_foreach(git_repository *repo, int (*)(git_submodule *, const char *, void *) callback, void *payload);

Parameters

In
repo

The repository

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

Function to be called with the name of each submodule. Return a non-zero value to terminate the iteration.

void *
In
payload

Extra data to pass to callback

Returns

int

0 on success, -1 on error, or non-zero return value of callback

Versions