@@ -123,21 +123,27 @@ typedef enum {
123123 * There may or may not be anything else at that path, but nothing that
124124 * looks like a submodule. In this case, this returns GIT_ENOTFOUND.
125125 *
126- * The submodule object is owned by the containing repo and will be freed
127- * when the repo is freed. The caller need not free the submodule.
126+ * You must call `git_submodule_free` when done with the submodule.
128127 *
129- * @param submodule Pointer to submodule description object pointer..
130- * @param repo The repository.
131- * @param name The name of the submodule. Trailing slashes will be ignored.
128+ * @param out Output ptr to submodule; pass NULL to just get return code
129+ * @param repo The parent repository
130+ * @param name The name of or path to the submodule; trailing slashes okay
132131 * @return 0 on success, GIT_ENOTFOUND if submodule does not exist,
133- * GIT_EEXISTS if submodule exists in working directory only, -1 on
134- * other errors.
132+ * GIT_EEXISTS if submodule exists in working directory only,
133+ * -1 on other errors.
135134 */
136135GIT_EXTERN (int ) git_submodule_lookup (
137- git_submodule * * submodule ,
136+ git_submodule * * out ,
138137 git_repository * repo ,
139138 const char * name );
140139
140+ /**
141+ * Release a submodule
142+ *
143+ * @param submodule Submodule object
144+ */
145+ GIT_EXTERN (void ) git_submodule_free (git_submodule * submodule );
146+
141147/**
142148 * Iterate over all tracked submodules of a repository.
143149 *
@@ -175,17 +181,19 @@ GIT_EXTERN(int) git_submodule_foreach(
175181 * `git_submodule_add_finalize()` to wrap up adding the new submodule and
176182 * .gitmodules to the index to be ready to commit.
177183 *
178- * @param submodule The newly created submodule ready to open for clone
179- * @param repo Superproject repository to contain the new submodule
180- * @param url URL for the submodules remote
184+ * You must call `git_submodule_free` on the submodule object when done.
185+ *
186+ * @param out The newly created submodule ready to open for clone
187+ * @param repo The repository in which you want to create the submodule
188+ * @param url URL for the submodule's remote
181189 * @param path Path at which the submodule should be created
182190 * @param use_gitlink Should workdir contain a gitlink to the repo in
183191 * .git/modules vs. repo directly in workdir.
184192 * @return 0 on success, GIT_EEXISTS if submodule already exists,
185193 * -1 on other errors.
186194 */
187195GIT_EXTERN (int ) git_submodule_add_setup (
188- git_submodule * * submodule ,
196+ git_submodule * * out ,
189197 git_repository * repo ,
190198 const char * url ,
191199 const char * path ,
@@ -493,15 +501,23 @@ GIT_EXTERN(int) git_submodule_open(
493501 *
494502 * Call this to reread cached submodule information for this submodule if
495503 * you have reason to believe that it has changed.
504+ *
505+ * @param submodule The submodule to reload
506+ * @param force Force reload even if the data doesn't seem out of date
507+ * @return 0 on success, <0 on error
496508 */
497- GIT_EXTERN (int ) git_submodule_reload (git_submodule * submodule );
509+ GIT_EXTERN (int ) git_submodule_reload (git_submodule * submodule , int force );
498510
499511/**
500512 * Reread all submodule info.
501513 *
502514 * Call this to reload all cached submodule information for the repo.
515+ *
516+ * @param repo The repository to reload submodule data for
517+ * @param force Force full reload even if the data doesn't seem out of date
518+ * @return 0 on success, <0 on error
503519 */
504- GIT_EXTERN (int ) git_submodule_reload_all (git_repository * repo );
520+ GIT_EXTERN (int ) git_submodule_reload_all (git_repository * repo , int force );
505521
506522/**
507523 * Get the status for a submodule.
0 commit comments