summaryrefslogtreecommitdiff
path: root/builtin/clone.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/clone.c')
-rw-r--r--builtin/clone.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 05f8fb4771..19ed64041d 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -302,6 +302,8 @@ static const struct ref *clone_local(const char *src_repo,
transport = transport_get(remote, src_repo);
ret = transport_get_remote_refs(transport);
transport_disconnect(transport);
+ if (0 <= option_verbosity)
+ printf("done.\n");
return ret;
}
@@ -359,7 +361,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;
@@ -412,6 +414,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]);
@@ -461,7 +466,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
die("could not create leading directories of '%s'", git_dir);
set_git_dir(make_absolute_path(git_dir));
- init_db(option_template, (option_verbosity < 0) ? INIT_DB_QUIET : 0);
+ if (0 <= option_verbosity)
+ printf("Cloning into %s%s...\n",
+ option_bare ? "bare repository " : "", dir);
+ init_db(option_template, INIT_DB_QUIET);
/*
* At this point, the config exists, so we do not need the
@@ -470,9 +478,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) {
@@ -498,22 +503,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)