summaryrefslogtreecommitdiff
path: root/builtin/push.c
diff options
context:
space:
mode:
authorHeiko Voigt <hvoigt@hvoigt.net>2012-03-29 07:21:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-03-30 16:02:55 (GMT)
commiteb21c732d6b642a8f33abd69071a95de01d5061b (patch)
tree69fd9caa7118ace0b1453830aa2ef86e006caef8 /builtin/push.c
parenta762e51ef2a39b0c326a1529dbe7f4cb303960db (diff)
downloadgit-eb21c732d6b642a8f33abd69071a95de01d5061b.zip
git-eb21c732d6b642a8f33abd69071a95de01d5061b.tar.gz
git-eb21c732d6b642a8f33abd69071a95de01d5061b.tar.bz2
push: teach --recurse-submodules the on-demand option
When using this option git will search for all submodules that have changed in the revisions to be send. It will then try to push the currently checked out branch of each submodule. This helps when a user has finished working on a change which involves submodules and just wants to push everything in one go. Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com> Mentored-by: Jens Lehmann <Jens.Lehmann@web.de> Mentored-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/push.c')
-rw-r--r--builtin/push.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/builtin/push.c b/builtin/push.c
index 35cce53..f9d2192 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -224,13 +224,21 @@ static int option_parse_recurse_submodules(const struct option *opt,
const char *arg, int unset)
{
int *flags = opt->value;
+
+ if (*flags & (TRANSPORT_RECURSE_SUBMODULES_CHECK |
+ TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND))
+ die("%s can only be used once.", opt->long_name);
+
if (arg) {
if (!strcmp(arg, "check"))
*flags |= TRANSPORT_RECURSE_SUBMODULES_CHECK;
+ else if (!strcmp(arg, "on-demand"))
+ *flags |= TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND;
else
die("bad %s argument: %s", opt->long_name, arg);
} else
- die("option %s needs an argument (check)", opt->long_name);
+ die("option %s needs an argument (check|on-demand)",
+ opt->long_name);
return 0;
}