Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/submodule--helper.c26
-rwxr-xr-xgit-submodule.sh9
2 files changed, 29 insertions, 6 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index c6df64bf6a..17dabf3d12 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2000,6 +2000,7 @@ struct submodule_update_clone {
int failed_clones_nr, failed_clones_alloc;
int max_jobs;
+ unsigned int init;
};
#define SUBMODULE_UPDATE_CLONE_INIT { \
.list = MODULE_LIST_INIT, \
@@ -2509,6 +2510,8 @@ static int update_clone(int argc, const char **argv, const char *prefix)
int ret;
struct option module_update_clone_options[] = {
+ OPT_BOOL(0, "init", &suc.init,
+ N_("initialize uninitialized submodules before update")),
OPT_STRING(0, "prefix", &prefix,
N_("path"),
N_("path into the working tree")),
@@ -2567,6 +2570,29 @@ static int update_clone(int argc, const char **argv, const char *prefix)
if (pathspec.nr)
suc.warn_if_uninitialized = 1;
+ if (suc.init) {
+ struct module_list list = MODULE_LIST_INIT;
+ struct init_cb info = INIT_CB_INIT;
+
+ if (module_list_compute(argc, argv, suc.prefix,
+ &pathspec, &list) < 0)
+ return 1;
+
+ /*
+ * If there are no path args and submodule.active is set then,
+ * by default, only initialize 'active' modules.
+ */
+ if (!argc && git_config_get_value_multi("submodule.active"))
+ module_list_active(&list);
+
+ info.prefix = suc.prefix;
+ info.superprefix = suc.recursive_prefix;
+ if (suc.quiet)
+ info.flags |= OPT_QUIET;
+
+ for_each_listed_submodule(&list, init_submodule_cb, &info);
+ }
+
ret = update_submodules(&suc);
list_objects_filter_release(&filter_options);
return ret;
diff --git a/git-submodule.sh b/git-submodule.sh
index 882bf097d5..16dea0ca59 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -361,14 +361,11 @@ cmd_update()
usage
fi
- if test -n "$init"
- then
- cmd_init "--" "$@" || return
- fi
-
{
- git submodule--helper update-clone ${GIT_QUIET:+--quiet} \
+ git ${wt_prefix:+-C "$wt_prefix"} submodule--helper update-clone \
+ ${GIT_QUIET:+--quiet} \
${progress:+"--progress"} \
+ ${init:+--init} \
${wt_prefix:+--prefix "$wt_prefix"} \
${prefix:+--recursive-prefix "$prefix"} \
${update:+--update "$update"} \