diff options
author | Stefan Beller <sbeller@google.com> | 2017-06-23 12:13:00 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-06-23 15:26:55 -0700 |
commit | 886dc154d8086dffb16e0830a1db2f024758fe52 (patch) | |
tree | 7433ada8d7e957d68d0790d65cbc098ae790cea4 /builtin | |
parent | 5402b1352f5181247405fbff1887008a0cb3b04a (diff) | |
download | git-886dc154d8086dffb16e0830a1db2f024758fe52.tar.gz |
builtin/fetch: factor submodule recurse parsing out to submodule config
Later we want to access this parsing in builtin/pull as well.
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/fetch.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index 100248c5af..9d58dc0a8a 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -53,20 +53,6 @@ static int shown_url = 0; static int refmap_alloc, refmap_nr; static const char **refmap_array; -static int option_parse_recurse_submodules(const struct option *opt, - const char *arg, int unset) -{ - if (unset) { - recurse_submodules = RECURSE_SUBMODULES_OFF; - } else { - if (arg) - recurse_submodules = parse_fetch_recurse_submodules_arg(opt->long_name, arg); - else - recurse_submodules = RECURSE_SUBMODULES_ON; - } - return 0; -} - static int git_fetch_config(const char *k, const char *v, void *cb) { if (!strcmp(k, "fetch.prune")) { @@ -115,9 +101,9 @@ static struct option builtin_fetch_options[] = { N_("number of submodules fetched in parallel")), OPT_BOOL('p', "prune", &prune, N_("prune remote-tracking branches no longer on remote")), - { OPTION_CALLBACK, 0, "recurse-submodules", NULL, N_("on-demand"), + { OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules, N_("on-demand"), N_("control recursive fetching of submodules"), - PARSE_OPT_OPTARG, option_parse_recurse_submodules }, + PARSE_OPT_OPTARG, option_fetch_parse_recurse_submodules }, OPT_BOOL(0, "dry-run", &dry_run, N_("dry run")), OPT_BOOL('k', "keep", &keep, N_("keep downloaded pack")), |