* [GSoC PATCH] submodule: warn on valueless active config
@ 2026-08-14 17:37 Tilak Raaz
2026-08-14 17:56 ` Weijie Yuan
0 siblings, 1 reply; 5+ messages in thread
From: Tilak Raaz @ 2026-08-14 17:37 UTC (permalink / raw)
To: git
[-- Attachment #1.1: Type: text/plain, Size: 666 bytes --]
Hi everyone,
My name is Tilak (he/him), and I am a second-year Electronics and
Instrumentation Engineering student at NIT Rourkela. I am preparing to
apply for GSoC 2027 and am starting my contributions to Git.
Regarding my background with Git: I have built Git from source,
successfully
navigated the codebase, and tackled the NEEDSWORK comment regarding
valueless 'submodule.active' configurations in submodule.c.
Below is my microproject patch resolving this issue by switching from
repo_config_get_string_multi() to repo_config_get_value_multi() and
adding an automated test case in t7400-submodule-basic.sh.
I look forward to your feedback!
Thanks,
Tilak
[-- Attachment #1.2: Type: text/html, Size: 761 bytes --]
[-- Attachment #2: 0001-submodule-warn-on-valueless-active-config.patch --]
[-- Type: application/octet-stream, Size: 3046 bytes --]
From 08a2f244efab6e4cf21638d87a721ca664ed9433 Mon Sep 17 00:00:00 2001
From: tilak-raaz <raaztilak07@gmail.com>
Date: Fri, 14 Aug 2026 22:50:11 +0530
Subject: [GSoC PATCH] submodule: warn on valueless active config
The config parser previously threw a hard error if 'submodule.active'
was provided without a value, causing commands to abort.
Swap repo_config_get_string_multi() to repo_config_get_value_multi()
to parse valueless keys safely, and emit a warning to the user rather
than crashing.
This resolves a NEEDSWORK comment in submodule.c.
Signed-off-by: tilak-raaz <raaztilak07@gmail.com>
---
submodule.c | 16 ++++++++--------
t/t7400-submodule-basic.sh | 11 +++++++++++
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/submodule.c b/submodule.c
index 5c92575888..b709c429ba 100644
--- a/submodule.c
+++ b/submodule.c
@@ -231,11 +231,7 @@ int option_parse_recurse_submodules_worktree_updater(const struct option *opt,
/*
* Determine if a submodule has been initialized at a given 'path'
*/
-/*
- * NEEDSWORK: Emit a warning if submodule.active exists, but is valueless,
- * ie, the config looks like: "[submodule] active\n".
- * Since that is an invalid pathspec, we should inform the user.
- */
+
int is_tree_submodule_active(struct repository *repo,
const struct object_id *treeish_name,
const char *path)
@@ -261,14 +257,18 @@ int is_tree_submodule_active(struct repository *repo,
free(key);
/* submodule.active is set */
- if (!repo_config_get_string_multi(repo, "submodule.active", &sl)) {
+ if (!repo_config_get_value_multi(repo, "submodule.active", &sl)) {
struct pathspec ps;
struct strvec args = STRVEC_INIT;
const struct string_list_item *item;
for_each_string_list_item(item, sl) {
- strvec_push(&args, item->string);
- }
+ if (!item->string) {
+ warning(_("submodule.active is present but has no value"));
+ continue;
+ }
+ strvec_push(&args, item->string);
+ }
parse_pathspec(&ps, 0, 0, NULL, args.v);
ret = match_pathspec(repo->index, &ps, path, strlen(path), 0, NULL, 1);
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index eefdecb0bd..afc62ffa0b 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -1549,4 +1549,15 @@ test_expect_success 'submodule add fails when name is reused' '
)
'
+
+test_expect_success 'warn on valueless submodule.active' '
+ test_when_finished "rm -rf empty-active" &&
+ git init empty-active &&
+ test_commit -C empty-active initial &&
+ git -c protocol.file.allow=always -C empty-active submodule add ../empty-active sub &&
+ git -C empty-active config --unset submodule.sub.active &&
+ printf "[submodule]\n\tactive\n" >>empty-active/.git/config &&
+ git -C empty-active submodule status 2>err &&
+ grep "submodule.active is present but has no value" err
+'
test_done
--
2.50.1 (Apple Git-155)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [GSoC PATCH] submodule: warn on valueless active config
2026-08-14 17:37 [GSoC PATCH] submodule: warn on valueless active config Tilak Raaz
@ 2026-08-14 17:56 ` Weijie Yuan
2026-08-14 18:04 ` Tilak Raaz
0 siblings, 1 reply; 5+ messages in thread
From: Weijie Yuan @ 2026-08-14 17:56 UTC (permalink / raw)
To: Tilak Raaz; +Cc: git
On Fri, Aug 14, 2026 at 11:07:29PM +0530, Tilak Raaz wrote:
> Hi everyone,
>
> My name is Tilak (he/him), and I am a second-year Electronics and
> Instrumentation Engineering student at NIT Rourkela. I am preparing to
> apply for GSoC 2027 and am starting my contributions to Git.
>
> Regarding my background with Git: I have built Git from source,
> successfully
> navigated the codebase, and tackled the NEEDSWORK comment regarding
> valueless 'submodule.active' configurations in submodule.c.
>
> Below is my microproject patch resolving this issue by switching from
> repo_config_get_string_multi() to repo_config_get_value_multi() and
> adding an automated test case in t7400-submodule-basic.sh.
>
> I look forward to your feedback!
Thanks!
However, my suggestion is that it would be better to place your patch in
the main body of the email text rather than in the attachment.
Please take a look at Documentation/SubmittingPatches [[attachment]]
And it also seems that the automated program 'b4' is unable to recognize
your patch, which may make the development process less convenient for
the developers and the maintainer.
$ b4 am https://lore.kernel.org/git/CABB4Jh3UUXvmAJpefaiP-xVRQfGRdTF2jW8GkdhbA1BXe6Okdw@mail.gmail.com/
Looking up CABB4Jh3UUXvmAJpefaiP-xVRQfGRdTF2jW8GkdhbA1BXe6Okdw@mail.gmail.com
Analyzing 1 messages in the thread
No patches found.
Please correct me if I'm wrong.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [GSoC PATCH] submodule: warn on valueless active config
2026-08-14 17:56 ` Weijie Yuan
@ 2026-08-14 18:04 ` Tilak Raaz
2026-08-14 19:07 ` D. Ben Knoble
2026-08-14 19:14 ` Junio C Hamano
0 siblings, 2 replies; 5+ messages in thread
From: Tilak Raaz @ 2026-08-14 18:04 UTC (permalink / raw)
To: Weijie Yuan; +Cc: git
On Fri, Aug 14, 2026 Weijie Yuan <wy@wyuan.org> wrote:
> Thanks!
>
> However, my suggestion is that it would be better to place your patch in
> the main body of the email text rather than in the attachment.
> Please take a look at Documentation/SubmittingPatches
>
> And it also seems that the automated program 'b4' is unable to recognize
> your patch, which may make the development process less convenient for
> the developers and the maintainer.
Hi Weijie,
Thank you for the quick feedback and for pointing me to the documentation!
I apologize for using an attachment; I am still getting my mailing list workflow
configured.
Here is the patch provided inline as plain text so that `b4` can parse
it correctly:
From 08a2f244efab6e4cf21638d87a721ca664ed9433 Mon Sep 17 00:00:00 2001
From: tilak-raaz <raaztilak07@gmail.com>
Date: Fri, 14 Aug 2026 22:50:11 +0530
Subject: [GSoC PATCH] submodule: warn on valueless active config
The config parser previously threw a hard error if 'submodule.active'
was provided without a value, causing commands to abort.
Swap repo_config_get_string_multi() to repo_config_get_value_multi()
to parse valueless keys safely, and emit a warning to the user rather
than crashing.
This resolves a NEEDSWORK comment in submodule.c.
Signed-off-by: tilak-raaz <raaztilak07@gmail.com>
---
submodule.c | 16 ++++++++--------
t/t7400-submodule-basic.sh | 11 +++++++++++
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/submodule.c b/submodule.c
index 5c92575888..b709c429ba 100644
--- a/submodule.c
+++ b/submodule.c
@@ -231,11 +231,7 @@ int
option_parse_recurse_submodules_worktree_updater(const struct option
*opt,
/*
* Determine if a submodule has been initialized at a given 'path'
*/
-/*
- * NEEDSWORK: Emit a warning if submodule.active exists, but is valueless,
- * ie, the config looks like: "[submodule] active\n".
- * Since that is an invalid pathspec, we should inform the user.
- */
+
int is_tree_submodule_active(struct repository *repo,
const struct object_id *treeish_name,
const char *path)
@@ -261,14 +257,18 @@ int is_tree_submodule_active(struct repository *repo,
free(key);
/* submodule.active is set */
- if (!repo_config_get_string_multi(repo, "submodule.active", &sl)) {
+ if (!repo_config_get_value_multi(repo, "submodule.active", &sl)) {
struct pathspec ps;
struct strvec args = STRVEC_INIT;
const struct string_list_item *item;
for_each_string_list_item(item, sl) {
- strvec_push(&args, item->string);
- }
+ if (!item->string) {
+ warning(_("submodule.active is present but
has no value"));
+ continue;
+ }
+ strvec_push(&args, item->string);
+ }
parse_pathspec(&ps, 0, 0, NULL, args.v);
ret = match_pathspec(repo->index, &ps, path, strlen(path), 0, NULL, 1);
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index eefdecb0bd..afc62ffa0b 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -1549,4 +1549,15 @@ test_expect_success 'submodule add fails when
name is reused' '
)
'
+
+test_expect_success 'warn on valueless submodule.active' '
+ test_when_finished "rm -rf empty-active" &&
+ git init empty-active &&
+ test_commit -C empty-active initial &&
+ git -c protocol.file.allow=always -C empty-active submodule
add ../empty-active sub &&
+ git -C empty-active config --unset submodule.sub.active &&
+ printf "[submodule]\n\tactive\n" >>empty-active/.git/config &&
+ git -C empty-active submodule status 2>err &&
+ grep "submodule.active is present but has no value" err
+'
test_done
--
2.50.1 (Apple Git-155)
On Fri, Aug 14, 2026 at 11:26 PM Weijie Yuan <wy@wyuan.org> wrote:
>
> On Fri, Aug 14, 2026 at 11:07:29PM +0530, Tilak Raaz wrote:
> > Hi everyone,
> >
> > My name is Tilak (he/him), and I am a second-year Electronics and
> > Instrumentation Engineering student at NIT Rourkela. I am preparing to
> > apply for GSoC 2027 and am starting my contributions to Git.
> >
> > Regarding my background with Git: I have built Git from source,
> > successfully
> > navigated the codebase, and tackled the NEEDSWORK comment regarding
> > valueless 'submodule.active' configurations in submodule.c.
> >
> > Below is my microproject patch resolving this issue by switching from
> > repo_config_get_string_multi() to repo_config_get_value_multi() and
> > adding an automated test case in t7400-submodule-basic.sh.
> >
> > I look forward to your feedback!
>
> Thanks!
>
> However, my suggestion is that it would be better to place your patch in
> the main body of the email text rather than in the attachment.
> Please take a look at Documentation/SubmittingPatches [[attachment]]
>
> And it also seems that the automated program 'b4' is unable to recognize
> your patch, which may make the development process less convenient for
> the developers and the maintainer.
>
> $ b4 am https://lore.kernel.org/git/CABB4Jh3UUXvmAJpefaiP-xVRQfGRdTF2jW8GkdhbA1BXe6Okdw@mail.gmail.com/
> Looking up CABB4Jh3UUXvmAJpefaiP-xVRQfGRdTF2jW8GkdhbA1BXe6Okdw@mail.gmail.com
> Analyzing 1 messages in the thread
> No patches found.
>
> Please correct me if I'm wrong.
>
> Thanks.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [GSoC PATCH] submodule: warn on valueless active config
2026-08-14 18:04 ` Tilak Raaz
@ 2026-08-14 19:07 ` D. Ben Knoble
2026-08-14 19:14 ` Junio C Hamano
1 sibling, 0 replies; 5+ messages in thread
From: D. Ben Knoble @ 2026-08-14 19:07 UTC (permalink / raw)
To: Tilak Raaz; +Cc: Weijie Yuan, git
On Fri, Aug 14, 2026 at 2:05 PM Tilak Raaz <raaztilak07@gmail.com> wrote:
>
> On Fri, Aug 14, 2026 Weijie Yuan <wy@wyuan.org> wrote:
> > Thanks!
> >
> > However, my suggestion is that it would be better to place your patch in
> > the main body of the email text rather than in the attachment.
> > Please take a look at Documentation/SubmittingPatches
> >
> > And it also seems that the automated program 'b4' is unable to recognize
> > your patch, which may make the development process less convenient for
> > the developers and the maintainer.
>
> Hi Weijie,
>
> Thank you for the quick feedback and for pointing me to the documentation!
> I apologize for using an attachment; I am still getting my mailing list workflow
> configured.
>
> Here is the patch provided inline as plain text so that `b4` can parse
> it correctly:
>
> From 08a2f244efab6e4cf21638d87a721ca664ed9433 Mon Sep 17 00:00:00 2001
> From: tilak-raaz <raaztilak07@gmail.com>
> Date: Fri, 14 Aug 2026 22:50:11 +0530
> Subject: [GSoC PATCH] submodule: warn on valueless active config
>
> The config parser previously threw a hard error if 'submodule.active'
> was provided without a value, causing commands to abort.
>
> Swap repo_config_get_string_multi() to repo_config_get_value_multi()
> to parse valueless keys safely, and emit a warning to the user rather
> than crashing.
>
> This resolves a NEEDSWORK comment in submodule.c.
>
> Signed-off-by: tilak-raaz <raaztilak07@gmail.com>
> ---
> submodule.c | 16 ++++++++--------
> t/t7400-submodule-basic.sh | 11 +++++++++++
> 2 files changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/submodule.c b/submodule.c
> index 5c92575888..b709c429ba 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -231,11 +231,7 @@ int
> option_parse_recurse_submodules_worktree_updater(const struct option
> *opt,
> /*
> * Determine if a submodule has been initialized at a given 'path'
> */
> -/*
> - * NEEDSWORK: Emit a warning if submodule.active exists, but is valueless,
> - * ie, the config looks like: "[submodule] active\n".
> - * Since that is an invalid pathspec, we should inform the user.
> - */
> +
> int is_tree_submodule_active(struct repository *repo,
> const struct object_id *treeish_name,
> const char *path)
> @@ -261,14 +257,18 @@ int is_tree_submodule_active(struct repository *repo,
> free(key);
>
> /* submodule.active is set */
> - if (!repo_config_get_string_multi(repo, "submodule.active", &sl)) {
> + if (!repo_config_get_value_multi(repo, "submodule.active", &sl)) {
> struct pathspec ps;
> struct strvec args = STRVEC_INIT;
> const struct string_list_item *item;
>
> for_each_string_list_item(item, sl) {
> - strvec_push(&args, item->string);
> - }
It's hard to tell, but I think (depending on _how_ you sent this patch
with GMail) the indentation has become corrupted, and the patch won't
apply.
Give the tips in git-send-email.io a try; especially with GMail, I've
found the safest way to send patches is with git-send-email. (I reply
to conversations from just about any mail client, though.)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [GSoC PATCH] submodule: warn on valueless active config
2026-08-14 18:04 ` Tilak Raaz
2026-08-14 19:07 ` D. Ben Knoble
@ 2026-08-14 19:14 ` Junio C Hamano
1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2026-08-14 19:14 UTC (permalink / raw)
To: Tilak Raaz; +Cc: Weijie Yuan, git
Tilak Raaz <raaztilak07@gmail.com> writes:
> The config parser previously threw a hard error if 'submodule.active'
> was provided without a value, causing commands to abort.
The standard helper to use is config_error_nonbool() when you need
to report a section.variable defined this way
[section]
variable
without "= value", and section.variable cannot be a Boolean true.
The patch seems to be heavily whitespace damaged, and cannot be
used, though.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-14 19:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14 17:37 [GSoC PATCH] submodule: warn on valueless active config Tilak Raaz
2026-08-14 17:56 ` Weijie Yuan
2026-08-14 18:04 ` Tilak Raaz
2026-08-14 19:07 ` D. Ben Knoble
2026-08-14 19:14 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox