| 2031 | } |
| 2032 | |
| 2033 | static int module_clone(int argc, const char **argv, const char *prefix, |
| 2034 | struct repository *repo UNUSED) |
| 2035 | { |
| 2036 | int dissociate = 0, quiet = 0, progress = 0, require_init = 0; |
| 2037 | struct module_clone_data clone_data = MODULE_CLONE_DATA_INIT; |
| 2038 | struct string_list reference = STRING_LIST_INIT_NODUP; |
| 2039 | struct list_objects_filter_options filter_options = |
| 2040 | LIST_OBJECTS_FILTER_INIT; |
| 2041 | const char *ref_storage_format = NULL; |
| 2042 | |
| 2043 | struct option module_clone_options[] = { |
| 2044 | OPT_STRING(0, "prefix", &clone_data.prefix, |
| 2045 | N_("path"), |
| 2046 | N_("alternative anchor for relative paths")), |
| 2047 | OPT_STRING(0, "path", &clone_data.path, |
| 2048 | N_("path"), |
| 2049 | N_("where the new submodule will be cloned to")), |
| 2050 | OPT_STRING(0, "name", &clone_data.name, |
| 2051 | N_("string"), |
| 2052 | N_("name of the new submodule")), |
| 2053 | OPT_STRING(0, "url", &clone_data.url, |
| 2054 | N_("string"), |
| 2055 | N_("url where to clone the submodule from")), |
| 2056 | OPT_STRING_LIST(0, "reference", &reference, |
| 2057 | N_("repo"), |
| 2058 | N_("reference repository")), |
| 2059 | OPT_STRING(0, "ref-format", &ref_storage_format, N_("format"), |
| 2060 | N_("specify the reference format to use")), |
| 2061 | OPT_BOOL(0, "dissociate", &dissociate, |
| 2062 | N_("use --reference only while cloning")), |
| 2063 | OPT_INTEGER(0, "depth", &clone_data.depth, |
| 2064 | N_("depth for shallow clones")), |
| 2065 | OPT__QUIET(&quiet, "suppress output for cloning a submodule"), |
| 2066 | OPT_BOOL(0, "progress", &progress, |
| 2067 | N_("force cloning progress")), |
| 2068 | OPT_BOOL(0, "require-init", &require_init, |
| 2069 | N_("disallow cloning into non-empty directory")), |
| 2070 | OPT_BOOL(0, "single-branch", &clone_data.single_branch, |
| 2071 | N_("clone only one branch, HEAD or --branch")), |
| 2072 | OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options), |
| 2073 | OPT_END() |
| 2074 | }; |
| 2075 | const char *const git_submodule_helper_usage[] = { |
| 2076 | N_("git submodule--helper clone [--prefix=<path>] [--quiet] " |
| 2077 | "[--reference <repository>] [--name <name>] [--depth <depth>] " |
| 2078 | "[--single-branch] [--filter <filter-spec>] " |
| 2079 | "--url <url> --path <path>"), |
| 2080 | NULL |
| 2081 | }; |
| 2082 | |
| 2083 | argc = parse_options(argc, argv, prefix, module_clone_options, |
| 2084 | git_submodule_helper_usage, 0); |
| 2085 | |
| 2086 | if (ref_storage_format) { |
| 2087 | clone_data.ref_storage_format = ref_storage_format_by_name(ref_storage_format); |
| 2088 | if (clone_data.ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN) |
| 2089 | die(_("unknown ref storage format '%s'"), ref_storage_format); |
| 2090 | } |
nothing calls this directly
no test coverage detected