Skip to content

Commit 9a0fb3e

Browse files
ao2gitster
authored andcommitted
submodule-config: pass repository as argument to config_from_gitmodules
Generalize config_from_gitmodules() to accept a repository as an argument. This is in preparation to reuse the function in repo_read_gitmodules in order to have a single point where the '.gitmodules' file is accessed. Signed-off-by: Antonio Ospite <[email protected]> Acked-by: Brandon Williams <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 588929d commit 9a0fb3e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

submodule-config.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -680,10 +680,10 @@ void submodule_free(struct repository *r)
680680
* Runs the provided config function on the '.gitmodules' file found in the
681681
* working directory.
682682
*/
683-
static void config_from_gitmodules(config_fn_t fn, void *data)
683+
static void config_from_gitmodules(config_fn_t fn, struct repository *repo, void *data)
684684
{
685-
if (the_repository->worktree) {
686-
char *file = repo_worktree_path(the_repository, GITMODULES_FILE);
685+
if (repo->worktree) {
686+
char *file = repo_worktree_path(repo, GITMODULES_FILE);
687687
git_config_from_file(fn, file, data);
688688
free(file);
689689
}
@@ -714,7 +714,7 @@ void fetch_config_from_gitmodules(int *max_children, int *recurse_submodules)
714714
.max_children = max_children,
715715
.recurse_submodules = recurse_submodules
716716
};
717-
config_from_gitmodules(gitmodules_fetch_config, &config);
717+
config_from_gitmodules(gitmodules_fetch_config, the_repository, &config);
718718
}
719719

720720
static int gitmodules_update_clone_config(const char *var, const char *value,
@@ -728,5 +728,5 @@ static int gitmodules_update_clone_config(const char *var, const char *value,
728728

729729
void update_clone_config_from_gitmodules(int *max_jobs)
730730
{
731-
config_from_gitmodules(gitmodules_update_clone_config, &max_jobs);
731+
config_from_gitmodules(gitmodules_update_clone_config, the_repository, &max_jobs);
732732
}

0 commit comments

Comments
 (0)