The --recurse-submodules command line parameter has existed for some
time but it has no config file equivalent.
Following the style of the corresponding parameter for git fetch, let's
invent push.recurseSubmodules to provide a default for this
parameter. This also requires the addition of --recurse-submodules=no to
allow the configuration to be overridden on the command line when
required.
The most straightforward way to implement this appears to be to make
push use code in submodule-config in a similar way to fetch.
Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Jeff King <peff@peff.net>
@ -257,16 +257,20 @@ origin +master` to force a push to the `master` branch). See the
@@ -257,16 +257,20 @@ origin +master` to force a push to the `master` branch). See the
is specified. This flag forces progress status even if the
standard error stream is not directed to a terminal.
--recurse-submodules=check|on-demand::
Make sure all submodule commits used by the revisions to be
pushed are available on a remote-tracking branch. If 'check' is
used Git will verify that all submodule commits that changed in
the revisions to be pushed are available on at least one remote
of the submodule. If any commits are missing the push will be
aborted and exit with non-zero status. If 'on-demand' is used
all submodules that changed in the revisions to be pushed will
be pushed. If on-demand was not able to push all necessary
revisions it will also be aborted and exit with non-zero status.
--no-recurse-submodules::
--recurse-submodules=check|on-demand|no::
May be used to make sure all submodule commits used by the
revisions to be pushed are available on a remote-tracking branch.
If 'check' is used Git will verify that all submodule commits that
changed in the revisions to be pushed are available on at least one
remote of the submodule. If any commits are missing the push will
be aborted and exit with non-zero status. If 'on-demand' is used
all submodules that changed in the revisions to be pushed will be
pushed. If on-demand was not able to push all necessary revisions
it will also be aborted and exit with non-zero status. A value of
'no' or using '--no-recurse-submodules' can be used to override the
push.recurseSubmodules configuration variable when no submodule
recursion is required.
--[no-]verify::
Toggle the pre-push hook (see linkgit:githooks[5]). The
@ -64,7 +64,12 @@ test_expect_success 'push fails if submodule commit not on remote' '
@@ -64,7 +64,12 @@ test_expect_success 'push fails if submodule commit not on remote' '
@ -79,6 +84,151 @@ test_expect_success 'push succeeds after commit was pushed to remote' '
@@ -79,6 +84,151 @@ test_expect_success 'push succeeds after commit was pushed to remote' '
)
'
test_expect_success 'push succeeds if submodule commit not on remote but using on-demand on command line' '
(
cd work/gar/bage &&
>recurse-on-demand-on-command-line &&
git add recurse-on-demand-on-command-line &&
git commit -m "Recurse on-demand on command line junk"
) &&
(
cd work &&
git add gar/bage &&
git commit -m "Recurse on-demand on command line for gar/bage" &&