MCPcopy Create free account
hub / github.com/git/git / module_init

Function module_init

builtin/submodule--helper.c:666–707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

664}
665
666static int module_init(int argc, const char **argv, const char *prefix,
667 struct repository *repo UNUSED)
668{
669 struct init_cb info = INIT_CB_INIT;
670 struct pathspec pathspec = { 0 };
671 struct module_list list = MODULE_LIST_INIT;
672 int quiet = 0;
673 struct option module_init_options[] = {
674 OPT__QUIET(&quiet, N_("suppress output for initializing a submodule")),
675 OPT_END()
676 };
677 const char *const git_submodule_helper_usage[] = {
678 N_("git submodule init [<options>] [<path>]"),
679 NULL
680 };
681 int ret = 1;
682
683 argc = parse_options(argc, argv, prefix, module_init_options,
684 git_submodule_helper_usage, 0);
685
686 if (module_list_compute(argv, prefix, &pathspec, &list) < 0)
687 goto cleanup;
688
689 /*
690 * If there are no path args and submodule.active is set then,
691 * by default, only initialize 'active' modules.
692 */
693 if (!argc && !repo_config_get(the_repository, "submodule.active"))
694 module_list_active(&list);
695
696 info.prefix = prefix;
697 if (quiet)
698 info.flags |= OPT_QUIET;
699
700 for_each_listed_submodule(&list, init_submodule_cb, &info);
701
702 ret = 0;
703cleanup:
704 module_list_release(&list);
705 clear_pathspec(&pathspec);
706 return ret;
707}
708
709struct status_cb {
710 const char *prefix;

Callers

nothing calls this directly

Calls 7

parse_optionsFunction · 0.85
module_list_computeFunction · 0.85
repo_config_getFunction · 0.85
module_list_activeFunction · 0.85
module_list_releaseFunction · 0.85
clear_pathspecFunction · 0.85

Tested by

no test coverage detected