|
32 | 32 |
|
33 | 33 | static int all, append, dry_run, force, keep, multiple, prune, update_head_ok, verbosity; |
34 | 34 | static int progress = -1, recurse_submodules = RECURSE_SUBMODULES_DEFAULT; |
35 | | -static int tags = TAGS_DEFAULT; |
| 35 | +static int tags = TAGS_DEFAULT, unshallow; |
36 | 36 | static const char *depth; |
37 | 37 | static const char *upload_pack; |
38 | 38 | static struct strbuf default_rla = STRBUF_INIT; |
@@ -82,6 +82,9 @@ static struct option builtin_fetch_options[] = { |
82 | 82 | OPT_BOOL(0, "progress", &progress, N_("force progress reporting")), |
83 | 83 | OPT_STRING(0, "depth", &depth, N_("depth"), |
84 | 84 | N_("deepen history of shallow clone")), |
| 85 | + { OPTION_SET_INT, 0, "unshallow", &unshallow, NULL, |
| 86 | + N_("convert to a complete repository"), |
| 87 | + PARSE_OPT_NONEG | PARSE_OPT_NOARG, NULL, 1 }, |
85 | 88 | { OPTION_STRING, 0, "submodule-prefix", &submodule_prefix, N_("dir"), |
86 | 89 | N_("prepend this to submodule path output"), PARSE_OPT_HIDDEN }, |
87 | 90 | { OPTION_STRING, 0, "recurse-submodules-default", |
@@ -970,6 +973,18 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) |
970 | 973 | argc = parse_options(argc, argv, prefix, |
971 | 974 | builtin_fetch_options, builtin_fetch_usage, 0); |
972 | 975 |
|
| 976 | + if (unshallow) { |
| 977 | + if (depth) |
| 978 | + die(_("--depth and --unshallow cannot be used together")); |
| 979 | + else if (!is_repository_shallow()) |
| 980 | + die(_("--unshallow on a complete repository does not make sense")); |
| 981 | + else { |
| 982 | + static char inf_depth[12]; |
| 983 | + sprintf(inf_depth, "%d", INFINITE_DEPTH); |
| 984 | + depth = inf_depth; |
| 985 | + } |
| 986 | + } |
| 987 | + |
973 | 988 | if (recurse_submodules != RECURSE_SUBMODULES_OFF) { |
974 | 989 | if (recurse_submodules_default) { |
975 | 990 | int arg = parse_fetch_recurse_submodules_arg("--recurse-submodules-default", recurse_submodules_default); |
|
0 commit comments