From: Junio C Hamano <gitster@pobox.com>
To: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] submodule: skip redundant active entries when pattern covers path
Date: Thu, 24 Jul 2025 14:21:20 -0700 [thread overview]
Message-ID: <xmqq1pq5z3n3.fsf@gitster.g> (raw)
In-Reply-To: <20250724152418.45226-3-jayatheerthkulkarni2005@gmail.com> (K. Jayatheerth's message of "Thu, 24 Jul 2025 20:54:18 +0530")
K Jayatheerth <jayatheerthkulkarni2005@gmail.com> writes:
> @@ -3308,6 +3310,9 @@ static void configure_added_submodule(struct add_data *add_data)
> struct child_process add_submod = CHILD_PROCESS_INIT;
> struct child_process add_gitmodules = CHILD_PROCESS_INIT;
>
> + const struct string_list *values;
> + size_t i;
> + int matched = 0;
> key = xstrfmt("submodule.%s.url", add_data->sm_name);
> git_config_set_gently(key, add_data->realrepo);
> free(key);
The blank line should be between the end of block of decls
(i.e. "int matched = 0") and the first statement (i.e. "key =
xstrfmt(...)"), not there. You probably do not need "i" in such a
wide scope; just use
for (size_t i = 0; i < values->nr; i++)
in the only loop that uses it.
> @@ -3349,20 +3354,28 @@ static void configure_added_submodule(struct add_data *add_data)
> * is_submodule_active(), since that function needs to find
> * out the value of "submodule.active" again anyway.
> */
> - if (!git_config_get("submodule.active")) {
> + if (git_config_get("submodule.active") || /* key absent */
> + git_config_get_string_multi("submodule.active", &values)) {
Hmph, do we need two calls here, or would a single call to
get_string_multi() sufficient to learn what we want here? When
there is no such key, the function may fail (or succeed and leave
values->nr == 0), and either way, we can tell that there is no such
key, right?
next prev parent reply other threads:[~2025-07-24 21:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 15:24 [PATCH 0/2] Avoid submodule overwritten and skip redundant active entries K Jayatheerth
2025-07-24 15:24 ` [PATCH 1/2] submodule: prevent overwriting .gitmodules on path reuse K Jayatheerth
2025-07-24 20:53 ` Junio C Hamano
2025-07-24 15:24 ` [PATCH 2/2] submodule: skip redundant active entries when pattern covers path K Jayatheerth
2025-07-24 21:21 ` Junio C Hamano [this message]
2025-07-25 16:24 ` [PATCH 0/2] Avoid submodule overwritten and skip redundant active entries K Jayatheerth
2025-07-25 16:24 ` [PATCH 1/2] submodule: prevent overwriting .gitmodules on path reuse K Jayatheerth
2025-07-25 16:24 ` [PATCH 2/2] submodule: skip redundant active entries when pattern covers path K Jayatheerth
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=xmqq1pq5z3n3.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jayatheerthkulkarni2005@gmail.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.