From: Junio C Hamano <gitster@pobox.com>
To: Antonio Ospite <ao2@ao2.it>
Cc: git@vger.kernel.org, Brandon Williams <bmwill@google.com>,
Jonathan Nieder <jrnieder@gmail.com>,
Stefan Beller <sbeller@google.com>, Jeff King <peff@peff.net>
Subject: Re: [PATCH v2 5/6] submodule-config: pass repository as argument to config_from_gitmodules
Date: Tue, 26 Jun 2018 13:15:33 -0700 [thread overview]
Message-ID: <xmqq7emljod6.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180626104710.9859-6-ao2@ao2.it> (Antonio Ospite's message of "Tue, 26 Jun 2018 12:47:09 +0200")
Antonio Ospite <ao2@ao2.it> writes:
> Generlize config_from_gitmodules to accept a repository as an argument.
generalize???
>
> 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>
> ---
> submodule-config.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/submodule-config.c b/submodule-config.c
> index cd1f1e06a..602c46af2 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);
> }
next prev parent reply other threads:[~2018-06-26 20:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-26 10:47 [PATCH v2 0/6] Restrict the usage of config_from_gitmodules to submodule-config Antonio Ospite
2018-06-26 10:47 ` [PATCH v2 1/6] config: move config_from_gitmodules to submodule-config.c Antonio Ospite
2018-06-26 10:47 ` [PATCH v2 2/6] submodule-config: add helper function to get 'fetch' config from .gitmodules Antonio Ospite
2018-06-26 20:11 ` Junio C Hamano
2018-06-26 20:55 ` Antonio Ospite
2018-06-26 10:47 ` [PATCH v2 3/6] submodule-config: add helper to get 'update-clone' " Antonio Ospite
2018-06-26 10:47 ` [PATCH v2 4/6] submodule-config: make 'config_from_gitmodules' private Antonio Ospite
2018-06-26 20:15 ` Junio C Hamano
2018-06-26 10:47 ` [PATCH v2 5/6] submodule-config: pass repository as argument to config_from_gitmodules Antonio Ospite
2018-06-26 20:15 ` Junio C Hamano [this message]
2018-06-26 20:57 ` Antonio Ospite
2018-06-26 10:47 ` [PATCH v2 6/6] submodule-config: reuse config_from_gitmodules in repo_read_gitmodules Antonio Ospite
2018-06-26 17:05 ` [PATCH v2 0/6] Restrict the usage of config_from_gitmodules to submodule-config Brandon Williams
2018-06-26 20:24 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq7emljod6.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=ao2@ao2.it \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=peff@peff.net \
--cc=sbeller@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.