check_everything_connected: use a struct with named options
[gitweb.git] / builtin / clone.c
index 5f867e67d8066fe70fdd67c3d8e2853ea6c3eaa1..32fe6060c377d7a2b12983457b99216d082f017a 100644 (file)
@@ -40,7 +40,7 @@ static const char * const builtin_clone_usage[] = {
 
 static int option_no_checkout, option_bare, option_mirror, option_single_branch = -1;
 static int option_local = -1, option_no_hardlinks, option_shared, option_recursive;
-static int option_shallow_submodules = -1;
+static int option_shallow_submodules;
 static char *option_template, *option_depth;
 static char *option_origin = NULL;
 static char *option_branch = NULL;
@@ -49,8 +49,8 @@ static char *option_upload_pack = "git-upload-pack";
 static int option_verbosity;
 static int option_progress = -1;
 static enum transport_family family;
-static struct string_list option_config;
-static struct string_list option_reference;
+static struct string_list option_config = STRING_LIST_INIT_NODUP;
+static struct string_list option_reference = STRING_LIST_INIT_NODUP;
 static int option_dissociate;
 static int max_jobs = -1;
 
@@ -624,10 +624,13 @@ static void update_remote_refs(const struct ref *refs,
        const struct ref *rm = mapped_refs;
 
        if (check_connectivity) {
+               struct check_connected_options opt = CHECK_CONNECTED_INIT;
+
+               opt.transport = transport;
+
                if (transport->progress)
                        fprintf(stderr, _("Checking connectivity... "));
-               if (check_everything_connected_with_transport(iterate_ref_map,
-                                                             0, &rm, transport))
+               if (check_connected(iterate_ref_map, &rm, &opt))
                        die(_("remote did not send all necessary objects"));
                if (transport->progress)
                        fprintf(stderr, _("done.\n"));
@@ -738,8 +741,7 @@ static int checkout(void)
                struct argv_array args = ARGV_ARRAY_INIT;
                argv_array_pushl(&args, "submodule", "update", "--init", "--recursive", NULL);
 
-               if (option_shallow_submodules == 1
-                   || (option_shallow_submodules == -1 && option_depth))
+               if (option_shallow_submodules == 1)
                        argv_array_push(&args, "--depth=1");
 
                if (max_jobs != -1)