diff options
author | Antonio Ospite <ao2@ao2.it> | 2018-06-26 13:47:09 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-06-26 23:16:01 +0300 |
commit | 9a0fb3e772922685a8a3ed259afd52d097bd339c (patch) | |
tree | b200a61b2a2c3ec55e03852d64b88fe3bcef8574 | |
parent | 588929d54d110024fcce6b427e28a8a428a93d88 (diff) |
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 <ao2@ao2.it>
Acked-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | submodule-config.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/submodule-config.c b/submodule-config.c index cd1f1e06a6..602c46af21 100644 --- a/submodule-config.c +++ b/submodule-config.c @@ -680,10 +680,10 @@ void submodule_free(struct repository *r) * Runs the provided config function on the '.gitmodules' file found in the * working directory. */ -static void config_from_gitmodules(config_fn_t fn, void *data) +static void config_from_gitmodules(config_fn_t fn, struct repository *repo, void *data) { - if (the_repository->worktree) { - char *file = repo_worktree_path(the_repository, GITMODULES_FILE); + if (repo->worktree) { + char *file = repo_worktree_path(repo, GITMODULES_FILE); git_config_from_file(fn, file, data); free(file); } @@ -714,7 +714,7 @@ void fetch_config_from_gitmodules(int *max_children, int *recurse_submodules) .max_children = max_children, .recurse_submodules = recurse_submodules }; - config_from_gitmodules(gitmodules_fetch_config, &config); + config_from_gitmodules(gitmodules_fetch_config, the_repository, &config); } 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, void update_clone_config_from_gitmodules(int *max_jobs) { - config_from_gitmodules(gitmodules_update_clone_config, &max_jobs); + config_from_gitmodules(gitmodules_update_clone_config, the_repository, &max_jobs); } |