diff options
author | Mike Crowe <mac@mcrowe.com> | 2015-12-03 13:10:35 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-12-04 13:04:04 -0800 |
commit | d34141cd08fb1c6938eae329a7c3122b05e9eb01 (patch) | |
tree | 034d33dc8213b41628a010a0ac09abc98732c496 /builtin/push.c | |
parent | push: test that --recurse-submodules on command line overrides config (diff) | |
download | tgif-d34141cd08fb1c6938eae329a7c3122b05e9eb01.tar.xz |
push: follow the "last one wins" convention for --recurse-submodules
Use the "last one wins" convention for --recurse-submodules rather
than treating conflicting options as an error.
Also, fix the declaration of the file-scope recurse_submodules
global variable to put it on a separate line.
Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/push.c')
-rw-r--r-- | builtin/push.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/builtin/push.c b/builtin/push.c index f9b59b49a5..cc29277ea2 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -21,7 +21,8 @@ static int thin = 1; static int deleterefs; static const char *receivepack; static int verbosity; -static int progress = -1, recurse_submodules = RECURSE_SUBMODULES_DEFAULT; +static int progress = -1; +static int recurse_submodules = RECURSE_SUBMODULES_DEFAULT; static struct push_cas_option cas; @@ -455,9 +456,6 @@ static int option_parse_recurse_submodules(const struct option *opt, { int *recurse_submodules = opt->value; - if (*recurse_submodules != RECURSE_SUBMODULES_DEFAULT) - die("%s can only be used once.", opt->long_name); - if (unset) *recurse_submodules = RECURSE_SUBMODULES_OFF; else if (arg) @@ -532,7 +530,6 @@ int cmd_push(int argc, const char **argv, const char *prefix) int flags = 0; int tags = 0; int push_cert = -1; - int recurse_submodules_from_cmdline = RECURSE_SUBMODULES_DEFAULT; int rc; const char *repo = NULL; /* default repository */ struct option options[] = { @@ -550,7 +547,7 @@ int cmd_push(int argc, const char **argv, const char *prefix) 0, CAS_OPT_NAME, &cas, N_("refname>:<expect"), N_("require old value of ref to be at this value"), PARSE_OPT_OPTARG, parseopt_push_cas_option }, - { OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules_from_cmdline, N_("check|on-demand|no"), + { OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules, N_("check|on-demand|no"), N_("control recursive pushing of submodules"), PARSE_OPT_OPTARG, option_parse_recurse_submodules }, OPT_BOOL( 0 , "thin", &thin, N_("use thin pack")), @@ -581,9 +578,6 @@ int cmd_push(int argc, const char **argv, const char *prefix) if (deleterefs && argc < 2) die(_("--delete doesn't make sense without any refs")); - if (recurse_submodules_from_cmdline != RECURSE_SUBMODULES_DEFAULT) - recurse_submodules = recurse_submodules_from_cmdline; - if (recurse_submodules == RECURSE_SUBMODULES_CHECK) flags |= TRANSPORT_RECURSE_SUBMODULES_CHECK; else if (recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND) |