libgit2

git_submodule_update

Version:

Update a submodule. This will clone a missing submodule and checkout the subrepository to the commit specified in the index of the containing repository. If the submodule repository doesn't contain the target commit (e.g. because fetchRecurseSubmodules isn't set), then the submodule is fetched using the fetch options supplied in options.

Signature

int git_submodule_update(git_submodule *submodule, int init, git_submodule_update_options *options);

Parameters

In
submodule

Submodule object

int
In
init

If the submodule is not initialized, setting this flag to true will initialize the submodule before updating. Otherwise, this will return an error if attempting to update an uninitialized repository. but setting this to true forces them to be updated.

In
options

configuration options for the update. If NULL, the function works as though GIT_SUBMODULE_UPDATE_OPTIONS_INIT was passed.

Returns

int

0 on success, any non-zero return value from a callback function, or a negative value to indicate an error (use git_error_last for a detailed error message).

Versions