Stefan Beller <sbeller@xxxxxxxxxx> writes: > "git push --recurse-submodules=on-demand" adds each submodule as an > alternate with add_submodule_odb before checking whether the > submodule has anything to push and pushing it if so. > > However, it never accesses any objects from the submodule. > ... > Use is_submodule_populated_gently instead, which is simpler and > cheaper. > > Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> > --- > > Originally I intended to send this out as part of a larger series, > but the series is getting too large series, sending all things in smaller > units! This vaguely reminds me that you sent something imilar perhaps for a different codepath. Is "is it populated" a good thing to check here, though? IIRC, add-submodule-odb allows you to add the object database of an inactivated submodule, so this seems to change the behaviour. I do not know if the behaviour change is a good thing (i.e. bugfix) or not (i.e. regression) offhand, though. Thanks. > diff --git a/submodule.c b/submodule.c > index 111a3007fc..e20216bc0f 100644 > --- a/submodule.c > +++ b/submodule.c > @@ -966,7 +966,9 @@ static int push_submodule(const char *path, > const struct string_list *push_options, > int dry_run) > { > - if (add_submodule_odb(path)) > + int code; > + > + if (!is_submodule_populated_gently(path, &code)) > return 1; > > if (for_each_remote_ref_submodule(path, has_remote, NULL) > 0) {