Merge branch 'jt/submodule-on-demand'

Push all submodules recursively with
'--recurse-submodules=on-demand'.

* jt/submodule-on-demand:
  Doc: document push.recurseSubmodules=only
This commit is contained in:
Junio C Hamano
2022-11-23 11:22:25 +09:00
5 changed files with 73 additions and 15 deletions

View File

@ -1130,6 +1130,12 @@ static int push_submodule(const char *path,
if (for_each_remote_ref_submodule(path, has_remote, NULL) > 0) {
struct child_process cp = CHILD_PROCESS_INIT;
strvec_push(&cp.args, "push");
/*
* When recursing into a submodule, treat any "only" configurations as "on-
* demand", since "only" would not work (we need all submodules to be pushed
* in order to be able to push the superproject).
*/
strvec_push(&cp.args, "--recurse-submodules=only-is-on-demand");
if (dry_run)
strvec_push(&cp.args, "--dry-run");