Doc: document push.recurseSubmodules=only
Git learned pushing submodules without pushing the superproject by the user specifying --recurse-submodules=only through6c656c3fe4("submodules: add RECURSE_SUBMODULES_ONLY value", 2016-12-20) and225e8bf778("push: add option to push only submodules", 2016-12-20). For users who use this feature regularly, it is desirable to have an equivalent configuration. It turns out that such a configuration (push.recurseSubmodules=only) is already supported, even though it is neither documented nor mentioned in the commit messages, due to the way the --recurse-submodules=only feature was implemented (a function used to parse --recurse-submodules was updated to support "only", but that same function is used to parse push.recurseSubmodules too). What is left is to document it and test it, which is what this commit does. There is a possible point of confusion when recursing into a submodule that itself has the push.recurseSubmodules=only configuration, because if a repository has only its submodules pushed and not itself, its superproject can never be pushed. Therefore, treat such configurations as being "on-demand", and print a warning message. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
This commit is contained in:
committed by
Taylor Blau
parent
3b08839926
commit
e62f779ae6
@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user