Merge branch 'xl/record-partial-clone-origin'
authorJunio C Hamano <gitster@pobox.com>
Mon, 17 Jun 2019 17:15:20 +0000 (10:15 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Jun 2019 17:15:20 +0000 (10:15 -0700)
When creating a partial clone, the object filtering criteria is
recorded for the origin of the clone, but this incorrectly used a
hardcoded name "origin" to name that remote; it has been corrected
to honor the "--origin <name>" option.

* xl/record-partial-clone-origin:
clone: respect user supplied origin name when setting up partial clone

1  2 
builtin/clone.c
diff --combined builtin/clone.c
index bb864d2101c2158fe049ce7c4cb2665fabbc0328,356bae5ed72d2e510da08d8089fbdda607ba0e9f..5b9ebe994761bd7b45209037b6eab63e28a78efb
@@@ -67,7 -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)
@@@ -143,8 -142,6 +143,8 @@@ static struct option builtin_clone_opti
        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()
  };
  
@@@ -357,7 -354,8 +357,7 @@@ static void setup_reference(void
                             add_one_reference, &required);
  }
  
 -static void copy_alternates(struct strbuf *src, struct strbuf *dst,
 -                          const char *src_repo)
 +static void copy_alternates(struct strbuf *src, const char *src_repo)
  {
        /*
         * Read from the source objects/info/alternates file
@@@ -438,7 -436,7 +438,7 @@@ static void copy_or_link_directory(stru
  
                /* Files that cannot be copied bit-for-bit... */
                if (!strcmp(src->buf + src_baselen, "/info/alternates")) {
 -                      copy_alternates(src, dest, src_repo);
 +                      copy_alternates(src, src_repo);
                        continue;
                }
  
@@@ -793,11 -791,6 +793,11 @@@ static int checkout(int submodule_progr
                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);
        }
@@@ -1227,7 -1220,7 +1227,7 @@@ int cmd_clone(int argc, const char **ar
                        remote_head_points_at, &branch_top);
  
        if (filter_options.choice)
-               partial_clone_register("origin", &filter_options);
+               partial_clone_register(option_origin, &filter_options);
  
        if (is_local)
                clone_local(path, git_dir);