Skip to contentSkip to conversation

git submodule update strange output behavior.

DISCUSSION Carlo Wood 2 participants 7 messages Jan 9, 2020 – Jan 11, 2020

lore
Share & tools
lore

Carlo Wood

author
#0 lore raw

In a project containing submodules, one of the submodules contains a submodule itself, which in turn also contains a submodule.

Overview:

project/foobar  [submodule]
project/cwm4    [submodule]
project/evio    [submodule]

project/evio/protocol/matrixssl [submodule]
project/evio/protocol/matrixssl/cwm4 [submodule]

('protocol' is a normal subdirectory)

Running (with or without the --quiet),

$ git submodule --quiet update --init --recursive --remote
Fetching submodule protocol/matrixssl
Fetching submodule protocol/matrixssl/cwm4
Fetching submodule cwm4

This is odd (a bug imho) because

1) it seems to only print this fetching information for submodules inside submodules, not for the top-level submodules.
2) it even prints this when using --quiet
3) it prints this every time (also when there is nothing more to fetch).

Signature · 1 line
Carlo Wood <[email protected]>
#1 lore raw
Quoted 21 lines · Carlo Wood

In a project containing submodules, one of the submodules contains a submodule itself, which in turn also contains a submodule.

Overview:

project/foobar  [submodule]
project/cwm4    [submodule]
project/evio    [submodule]

project/evio/protocol/matrixssl [submodule]
project/evio/protocol/matrixssl/cwm4 [submodule]

('protocol' is a normal subdirectory)

Running (with or without the --quiet),

$ git submodule --quiet update --init --recursive --remote
Fetching submodule protocol/matrixssl
Fetching submodule protocol/matrixssl/cwm4
Fetching submodule cwm4
Quoted 6 lines

This is odd (a bug imho) because

1) it seems to only print this fetching information for submodules inside submodules, not for the top-level submodules.
2) it even prints this when using --quiet
3) it prints this every time (also when there is nothing more to fetch).

Sounds like a symptom of (a) the top-level "git submodule update" knowing how to react to "--quiet" but (b) it forgets to pass down the "--quiet" when it recursively runs "git submodule update" in its submodules?

#2 lore raw
Quoted 31 lines · Junio C Hamano
Quoted 21 lines · Carlo Wood

In a project containing submodules, one of the submodules contains a submodule itself, which in turn also contains a submodule.

Overview:

project/foobar  [submodule]
project/cwm4    [submodule]
project/evio    [submodule]

project/evio/protocol/matrixssl [submodule]
project/evio/protocol/matrixssl/cwm4 [submodule]

('protocol' is a normal subdirectory)

Running (with or without the --quiet),

$ git submodule --quiet update --init --recursive --remote
Fetching submodule protocol/matrixssl
Fetching submodule protocol/matrixssl/cwm4
Fetching submodule cwm4
Quoted 6 lines

This is odd (a bug imho) because

1) it seems to only print this fetching information for submodules inside submodules, not for the top-level submodules.
2) it even prints this when using --quiet
3) it prints this every time (also when there is nothing more to fetch).

Quoted 4 lines

Sounds like a symptom of (a) the top-level "git submodule update" knowing how to react to "--quiet" but (b) it forgets to pass down the "--quiet" when it recursively runs "git submodule update" in its submodules?

Just a shot in the dark. Not even compile tested ;-)

 submodule.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
submodule.c +2 -1
index 9da7181321..535bb6bf04 100644
@@ -1454,11 +1454,12 @@ static int get_next_submodule(struct child_process *cp,
 			argv_array_pushv(&cp->args, spf->args.argv);
 			argv_array_push(&cp->args, default_argv);
 			argv_array_push(&cp->args, "--submodule-prefix");
-
 			strbuf_addf(&submodule_prefix, "%s%s/",
 						       spf->prefix,
 						       task->sub->path);
 			argv_array_push(&cp->args, submodule_prefix.buf);
+			if (spf->quiet)
+				argv_array_push(&cp->args, "--quiet");
 
 			spf->count++;
 			*task_cb = task;
author
#6 lore raw
In reply to Junio C Hamano

That seems only part of the problem, but yes.

It is only part of the problem because without --quiet I get the same output; that is - the top-level is still quiet, but the submodules aren't. That is out of balance imho.

Quoted 37 lines · On Thu, 09 Jan 2020 10:54:27 -0800 Junio C Hamano <[email protected]> wrote:
Quoted 21 lines · Carlo Wood

In a project containing submodules, one of the submodules contains a submodule itself, which in turn also contains a submodule.

Overview:

project/foobar  [submodule]
project/cwm4    [submodule]
project/evio    [submodule]

project/evio/protocol/matrixssl [submodule]
project/evio/protocol/matrixssl/cwm4 [submodule]

('protocol' is a normal subdirectory)

Running (with or without the --quiet),

$ git submodule --quiet update --init --recursive --remote
Fetching submodule protocol/matrixssl
Fetching submodule protocol/matrixssl/cwm4
Fetching submodule cwm4
Quoted 7 lines

This is odd (a bug imho) because

1) it seems to only print this fetching information for submodules inside submodules, not for the top-level submodules.
2) it even prints this when using --quiet
3) it prints this every time (also when there is nothing more to fetch).

Sounds like a symptom of (a) the top-level "git submodule update" knowing how to react to "--quiet" but (b) it forgets to pass down the "--quiet" when it recursively runs "git submodule update" in its submodules?

Signature · 1 line
Carlo Wood <[email protected]>
author
#3 lore raw
In reply to Junio C Hamano

It seems to me that the other part of the problem is printing this output for submodules when nothing (needed to be) is fetched.

I haven't tested if output for the top-level is printed (without --quiet) when also there fetching is needed; is that even possible?

Quoted 63 lines · On Thu, 09 Jan 2020 12:03:55 -0800 Junio C Hamano <[email protected]> wrote:
Quoted 32 lines · Junio C Hamano
Quoted 21 lines · Carlo Wood

In a project containing submodules, one of the submodules contains a submodule itself, which in turn also contains a submodule.

Overview:

project/foobar  [submodule]
project/cwm4    [submodule]
project/evio    [submodule]

project/evio/protocol/matrixssl [submodule]
project/evio/protocol/matrixssl/cwm4 [submodule]

('protocol' is a normal subdirectory)

Running (with or without the --quiet),

$ git submodule --quiet update --init --recursive --remote
Fetching submodule protocol/matrixssl
Fetching submodule protocol/matrixssl/cwm4
Fetching submodule cwm4
Quoted 7 lines

This is odd (a bug imho) because

1) it seems to only print this fetching information for submodules inside submodules, not for the top-level submodules.
2) it even prints this when using --quiet
3) it prints this every time (also when there is nothing more to fetch).

Quoted 4 lines

Sounds like a symptom of (a) the top-level "git submodule update" knowing how to react to "--quiet" but (b) it forgets to pass down the "--quiet" when it recursively runs "git submodule update" in its submodules?

Just a shot in the dark. Not even compile tested ;-)

 submodule.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
submodule.c +0 -0
index 9da7181321..535bb6bf04 100644
@@ -1454,11 +1454,12 @@ static int get_next_submodule(struct
 child_process *cp, argv_array_pushv(&cp->args, spf->args.argv);
 			argv_array_push(&cp->args, default_argv);
 			argv_array_push(&cp->args,

"--submodule-prefix"); -

submodule.c +0 -0
 			strbuf_addf(&submodule_prefix, "%s%s/",
 						       spf->prefix,
 						       task->sub->path);
 			argv_array_push(&cp->args,

submodule_prefix.buf);

submodule.c +2 -0
+			if (spf->quiet)
+				argv_array_push(&cp->args,

"--quiet");

submodule.c +0 -0
 			spf->count++;
 			*task_cb = task;
Signature · 1 line
Carlo Wood <[email protected]>
#4 lore raw
Quoted 2 lines · Carlo Wood

It seems to me that the other part of the problem is printing this output for submodules when nothing (needed to be) is fetched.

Hmm, I am not sure if that is a reasonable expectation. Would it be possible to tell if there is something that needs to be fetched without attempting to contact the other side?

author
#5 lore raw
Quoted 8 lines · On Fri, 10 Jan 2020 11:36:54 -0800 Junio C Hamano <[email protected]> wrote:
Quoted 2 lines · Carlo Wood

It seems to me that the other part of the problem is printing this output for submodules when nothing (needed to be) is fetched.

Hmm, I am not sure if that is a reasonable expectation. Would it be possible to tell if there is something that needs to be fetched without attempting to contact the other side?

That wasn't even my point though: assume that we can't know, so we have to attempt a fetch anyway (seems indeed likely), then I'd expect to see this message for *every* submodule, and not just for submodules inside other submodule.

There is an asymmetry (in the output of this command) between submodules in the top level project and submodules inside other submodules.

This then makes me wonder after all, if the message is suppressed for top-level submodules then can't it also be suppressed for the others (those that are currently being printed)?

Signature · 1 line
Carlo Wood <[email protected]>