Git-Raw
view release on metacpan or search on metacpan
deps/libgit2/include/git2/submodule.h view on Meta::CPAN
GIT_SUBMODULE_STATUS_WD_DELETED = (1u << 9),
GIT_SUBMODULE_STATUS_WD_MODIFIED = (1u << 10),
GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED = (1u << 11),
GIT_SUBMODULE_STATUS_WD_WD_MODIFIED = (1u << 12),
GIT_SUBMODULE_STATUS_WD_UNTRACKED = (1u << 13)
} git_submodule_status_t;
#define GIT_SUBMODULE_STATUS__IN_FLAGS 0x000Fu
#define GIT_SUBMODULE_STATUS__INDEX_FLAGS 0x0070u
#define GIT_SUBMODULE_STATUS__WD_FLAGS 0x3F80u
#define GIT_SUBMODULE_STATUS_IS_UNMODIFIED(S) \
(((S) & ~GIT_SUBMODULE_STATUS__IN_FLAGS) == 0)
#define GIT_SUBMODULE_STATUS_IS_INDEX_UNMODIFIED(S) \
(((S) & GIT_SUBMODULE_STATUS__INDEX_FLAGS) == 0)
#define GIT_SUBMODULE_STATUS_IS_WD_UNMODIFIED(S) \
(((S) & (GIT_SUBMODULE_STATUS__WD_FLAGS & \
~GIT_SUBMODULE_STATUS_WD_UNINITIALIZED)) == 0)
#define GIT_SUBMODULE_STATUS_IS_WD_DIRTY(S) \
(((S) & (GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED | \
GIT_SUBMODULE_STATUS_WD_WD_MODIFIED | \
GIT_SUBMODULE_STATUS_WD_UNTRACKED)) != 0)
/**
* Function pointer to receive each submodule
*
* @param sm git_submodule currently being visited
* @param name name of the submodule
* @param payload value you passed to the foreach function as payload
* @return 0 on success or error code
*/
typedef int GIT_CALLBACK(git_submodule_cb)(
git_submodule *sm, const char *name, void *payload);
/**
* Submodule update options structure
*
* Initialize with `GIT_SUBMODULE_UPDATE_OPTIONS_INIT`. Alternatively, you can
* use `git_submodule_update_options_init`.
*
*/
typedef struct git_submodule_update_options {
unsigned int version;
/**
* These options are passed to the checkout step. To disable
* checkout, set the `checkout_strategy` to
* `GIT_CHECKOUT_NONE`. Generally you will want the use
* GIT_CHECKOUT_SAFE to update files in the working
* directory.
*/
git_checkout_options checkout_opts;
/**
* Options which control the fetch, including callbacks.
*
* The callbacks to use for reporting fetch progress, and for acquiring
* credentials in the event they are needed.
*/
git_fetch_options fetch_opts;
/**
* Allow fetching from the submodule's default remote if the target
* commit isn't found. Enabled by default.
*/
int allow_fetch;
} git_submodule_update_options;
#define GIT_SUBMODULE_UPDATE_OPTIONS_VERSION 1
#define GIT_SUBMODULE_UPDATE_OPTIONS_INIT \
{ GIT_SUBMODULE_UPDATE_OPTIONS_VERSION, \
{ GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE }, \
GIT_FETCH_OPTIONS_INIT, 1 }
/**
* Initialize git_submodule_update_options structure
*
* Initializes a `git_submodule_update_options` with default values. Equivalent to
* creating an instance with `GIT_SUBMODULE_UPDATE_OPTIONS_INIT`.
*
* @param opts The `git_submodule_update_options` struct to initialize.
* @param version The struct version; pass `GIT_SUBMODULE_UPDATE_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_submodule_update_options_init(
git_submodule_update_options *opts, unsigned int 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.
*
* @param submodule Submodule object
* @param 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.
* @param options configuration options for the update. If NULL, the
* function works as though GIT_SUBMODULE_UPDATE_OPTIONS_INIT was passed.
* @return 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).
*/
GIT_EXTERN(int) git_submodule_update(git_submodule *submodule, int init, git_submodule_update_options *options);
/**
* Lookup submodule information by name or path.
*
* Given either the submodule name or path (they are usually the same), this
* returns a structure describing the submodule.
*
* There are two expected error scenarios:
*
* - The submodule is not mentioned in the HEAD, the index, and the config,
* but does "exist" in the working directory (i.e. there is a subdirectory
* that appears to be a Git repository). In this case, this function
( run in 0.685 second using v1.01-cache-2.11-cpan-d8267643d1d )