fetch-pack: Finish negotation if remote replies "ACK %s ready"
[gitweb.git] / builtin / clone.c
index 3a3625b2ad97472c8486c9fbdd4ac6333699a37d..61e0989b5ab8fffb16ec28e64c38b4fa236cb3ed 100644 (file)
@@ -66,6 +66,8 @@ static struct option builtin_clone_options[] = {
                    "setup as shared repository"),
        OPT_BOOLEAN(0, "recursive", &option_recursive,
                    "initialize submodules in the clone"),
+       OPT_BOOLEAN(0, "recurse_submodules", &option_recursive,
+                   "initialize submodules in the clone"),
        OPT_STRING(0, "template", &option_template, "path",
                   "path the template repository"),
        OPT_STRING(0, "reference", &option_reference, "repo",
@@ -361,7 +363,7 @@ static void write_remote_refs(const struct ref *local_refs)
 
 int cmd_clone(int argc, const char **argv, const char *prefix)
 {
-       int is_bundle = 0;
+       int is_bundle = 0, is_local;
        struct stat buf;
        const char *repo_name, *repo, *work_tree, *git_dir;
        char *path, *dir;
@@ -414,6 +416,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
                repo = xstrdup(make_absolute_path(repo_name));
        else
                repo = repo_name;
+       is_local = path && !is_bundle;
+       if (is_local && option_depth)
+               warning("--depth is ignored in local clones; use file:// instead.");
 
        if (argc == 2)
                dir = xstrdup(argv[1]);
@@ -475,9 +480,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
         */
        unsetenv(CONFIG_ENVIRONMENT);
 
-       if (option_reference)
-               setup_reference(git_dir);
-
        git_config(git_default_config, NULL);
 
        if (option_bare) {
@@ -503,22 +505,25 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
                        git_config_set(key.buf, "true");
                        strbuf_reset(&key);
                }
-
-               strbuf_addf(&key, "remote.%s.url", option_origin);
-               git_config_set(key.buf, repo);
-               strbuf_reset(&key);
        }
 
+       strbuf_addf(&key, "remote.%s.url", option_origin);
+       git_config_set(key.buf, repo);
+       strbuf_reset(&key);
+
+       if (option_reference)
+               setup_reference(git_dir);
+
        fetch_pattern = value.buf;
        refspec = parse_fetch_refspec(1, &fetch_pattern);
 
        strbuf_reset(&value);
 
-       if (path && !is_bundle) {
+       if (is_local) {
                refs = clone_local(path, git_dir);
                mapped_refs = wanted_peer_refs(refs, refspec);
        } else {
-               struct remote *remote = remote_get(argv[0]);
+               struct remote *remote = remote_get(option_origin);
                transport = transport_get(remote, remote->url[0]);
 
                if (!transport->get_refs_list || !transport->fetch)