diff options
Diffstat (limited to 'include/git2/submodule.h')
| -rw-r--r-- | include/git2/submodule.h | 113 |
1 files changed, 41 insertions, 72 deletions
diff --git a/include/git2/submodule.h b/include/git2/submodule.h index 48faf8a49..cbafccd1b 100644 --- a/include/git2/submodule.h +++ b/include/git2/submodule.h @@ -301,20 +301,6 @@ GIT_EXTERN(int) git_submodule_add_to_index( int write_index); /** - * Write submodule settings to .gitmodules file. - * - * This commits any in-memory changes to the submodule to the gitmodules - * file on disk. You may also be interested in `git_submodule_init()` which - * writes submodule info to ".git/config" (which is better for local changes - * to submodule settings) and/or `git_submodule_sync()` which writes - * settings about remotes to the actual submodule repository. - * - * @param submodule The submodule to write. - * @return 0 on success, <0 on failure. - */ -GIT_EXTERN(int) git_submodule_save(git_submodule *submodule); - -/** * Get the containing repository for a submodule. * * This returns a pointer to the repository that contains the submodule. @@ -373,36 +359,31 @@ GIT_EXTERN(int) git_submodule_resolve_url(git_buf *out, git_repository *repo, co GIT_EXTERN(const char *) git_submodule_branch(git_submodule *submodule); /** - * Set the branch for the submodule. + * Set the branch for the submodule in the configuration * - * This sets the branch in memory for the submodule. This will be used for - * any following submodule actions while this submodule data is in memory. - * - * After calling this, you may wish to call `git_submodule_save()` to write - * the changes back to the ".gitmodules" file and `git_submodule_sync()` to + * After calling this, you may wish to call `git_submodule_sync()` to * write the changes to the checked out submodule repository. * - * @param submodule Pointer to the submodule object + * @param repo the repository to affect + * @param name the name of the submodule to configure * @param branch Branch that should be used for the submodule * @return 0 on success, <0 on failure */ -GIT_EXTERN(int) git_submodule_set_branch(git_submodule *submodule, const char *branch); +GIT_EXTERN(int) git_submodule_set_branch(git_repository *repo, const char *name, const char *branch); /** - * Set the URL for the submodule. + * Set the URL for the submodule in the configuration * - * This sets the URL in memory for the submodule. This will be used for - * any following submodule actions while this submodule data is in memory. * - * After calling this, you may wish to call `git_submodule_save()` to write - * the changes back to the ".gitmodules" file and `git_submodule_sync()` to + * After calling this, you may wish to call `git_submodule_sync()` to * write the changes to the checked out submodule repository. * - * @param submodule Pointer to the submodule object + * @param repo the repository to affect + * @param name the name of the submodule to configure * @param url URL that should be used for the submodule * @return 0 on success, <0 on failure */ -GIT_EXTERN(int) git_submodule_set_url(git_submodule *submodule, const char *url); +GIT_EXTERN(int) git_submodule_set_url(git_repository *repo, const char *name, const char *url); /** * Get the OID for the submodule in the index. @@ -452,9 +433,6 @@ GIT_EXTERN(const git_oid *) git_submodule_wd_id(git_submodule *submodule); * The working directory will be consider clean so long as there is a * checked out version present. * - * plus the special **GIT_SUBMODULE_IGNORE_RESET** which can be used with - * `git_submodule_set_ignore()` to revert to the on-disk setting. - * * @param submodule The submodule to check * @return The current git_submodule_ignore_t valyue what will be used for * this submodule. @@ -463,32 +441,25 @@ GIT_EXTERN(git_submodule_ignore_t) git_submodule_ignore( git_submodule *submodule); /** - * Set the ignore rule for the submodule. - * - * This sets the in-memory ignore rule for the submodule which will - * control the behavior of `git_submodule_status()`. + * Set the ignore rule for the submodule in the configuration * - * To make changes persistent, call `git_submodule_save()` to write the - * value to disk (in the ".gitmodules" and ".git/config" files). + * This does not affect any currently-loaded instances. * - * Call with `GIT_SUBMODULE_IGNORE_RESET` or call `git_submodule_reload()` - * to revert the in-memory rule to the value that is on disk. - * - * @param submodule The submodule to update + * @param repo the repository to affect + * @param name the name of the submdule * @param ignore The new value for the ignore rule - * @return old value for ignore + * @return 0 or an error code */ -GIT_EXTERN(git_submodule_ignore_t) git_submodule_set_ignore( - git_submodule *submodule, +GIT_EXTERN(int) git_submodule_set_ignore( + git_repository *repo, + const char *name, git_submodule_ignore_t ignore); /** * Get the update rule that will be used for the submodule. * * This value controls the behavior of the `git submodule update` command. - * There are four useful values documented with `git_submodule_update_t` - * plus the `GIT_SUBMODULE_UPDATE_RESET` which can be used to revert to - * the on-disk setting. + * There are four useful values documented with `git_submodule_update_t`. * * @param submodule The submodule to check * @return The current git_submodule_update_t value that will be used @@ -498,23 +469,18 @@ GIT_EXTERN(git_submodule_update_t) git_submodule_update_strategy( git_submodule *submodule); /** - * Set the update rule for the submodule. - * - * The initial value comes from the ".git/config" setting of - * `submodule.$name.update` for this submodule (which is initialized from - * the ".gitmodules" file). Using this function sets the update rule in - * memory for the submodule. Call `git_submodule_save()` to write out the - * new update rule. + * Set the update rule for the submodule in the configuration * - * Calling this again with GIT_SUBMODULE_UPDATE_RESET or calling - * `git_submodule_reload()` will revert the rule to the on disk value. + * This setting won't affect any existing instances. * - * @param submodule The submodule to update + * @param repo the repository to affect + * @param name the name of the submodule to configure * @param update The new value to use - * @return old value for update + * @return 0 or an error code */ -GIT_EXTERN(git_submodule_update_t) git_submodule_set_update( - git_submodule *submodule, +GIT_EXTERN(int) git_submodule_set_update( + git_repository *repo, + const char *name, git_submodule_update_t update); /** @@ -532,18 +498,18 @@ GIT_EXTERN(git_submodule_recurse_t) git_submodule_fetch_recurse_submodules( git_submodule *submodule); /** - * Set the fetchRecurseSubmodules rule for a submodule. + * Set the fetchRecurseSubmodules rule for a submodule in the configuration * - * This sets the submodule.<name>.fetchRecurseSubmodules value for - * the submodule. You should call `git_submodule_save()` if you want - * to persist the new value. + * This setting won't affect any existing instances. * - * @param submodule The submodule to modify + * @param repo the repository to affect + * @param name the submodule to configure * @param fetch_recurse_submodules Boolean value * @return old value for fetchRecurseSubmodules */ -GIT_EXTERN(git_submodule_recurse_t) git_submodule_set_fetch_recurse_submodules( - git_submodule *submodule, +GIT_EXTERN(int) git_submodule_set_fetch_recurse_submodules( + git_repository *repo, + const char *name, git_submodule_recurse_t fetch_recurse_submodules); /** @@ -634,16 +600,19 @@ GIT_EXTERN(int) git_submodule_reload_all(git_repository *repo, int force); * This looks at a submodule and tries to determine the status. It * will return a combination of the `GIT_SUBMODULE_STATUS` values above. * How deeply it examines the working directory to do this will depend - * on the `git_submodule_ignore_t` value for the submodule - which can be - * set either temporarily or permanently with `git_submodule_set_ignore()`. + * on the `git_submodule_ignore_t` value for the submodule. * * @param status Combination of `GIT_SUBMODULE_STATUS` flags - * @param submodule Submodule for which to get status + * @param repo the repository in which to look + * @param name name of the submodule + * @param ignore the ignore rules to follow * @return 0 on success, <0 on error */ GIT_EXTERN(int) git_submodule_status( unsigned int *status, - git_submodule *submodule); + git_repository *repo, + const char *name, + git_submodule_ignore_t ignore); /** * Get the locations of submodule information. |
