diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-06-17 20:15:17 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-06-17 20:15:17 +0300 |
commit | 94760948f17e1902e071172677e0615da6e03d90 (patch) | |
tree | be4b6601dce92894093a9d2acd01d701c4356009 /builtin | |
parent | 6e0b1c60ad3e6067d5cae51a7dc36e58184accd5 (diff) | |
parent | 4c6910163ab59f334becca39f5a83d3b7a622df4 (diff) |
Merge branch 'ba/clone-remote-submodules'
"git clone --recurse-submodules" learned to set up the submodules
to ignore commit object names recorded in the superproject gitlink
and instead use the commits that happen to be at the tip of the
remote-tracking branches from the get-go, by passing the new
"--remote-submodules" option.
* ba/clone-remote-submodules:
clone: add `--remote-submodules` flag
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/clone.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/builtin/clone.c b/builtin/clone.c index e3231864ca..bb864d2101 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -67,6 +67,7 @@ static int max_jobs = -1; static struct string_list option_recurse_submodules = STRING_LIST_INIT_NODUP; static struct list_objects_filter_options filter_options; static struct string_list server_options = STRING_LIST_INIT_NODUP; +static int option_remote_submodules; static int recurse_submodules_cb(const struct option *opt, const char *arg, int unset) @@ -142,6 +143,8 @@ static struct option builtin_clone_options[] = { OPT_SET_INT('6', "ipv6", &family, N_("use IPv6 addresses only"), TRANSPORT_FAMILY_IPV6), OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options), + OPT_BOOL(0, "remote-submodules", &option_remote_submodules, + N_("any cloned submodules will use their remote-tracking branch")), OPT_END() }; @@ -790,6 +793,11 @@ static int checkout(int submodule_progress) if (option_verbosity < 0) argv_array_push(&args, "--quiet"); + if (option_remote_submodules) { + argv_array_push(&args, "--remote"); + argv_array_push(&args, "--no-fetch"); + } + err = run_command_v_opt(args.argv, RUN_GIT_CMD); argv_array_clear(&args); } |