summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-23 11:35:49 -0700
committerJunio C Hamano <gitster@pobox.com>2014-07-23 11:35:49 -0700
commitbc88defa2f9f92324106dca48126039246ab00e1 (patch)
treef66da3d6ca42a3c8436ceab2b04f4200410206c7
parentc3d2bc720cd56af5a18eec219890dcff701680f8 (diff)
parentf38aa83f9a20765d4617c46283a13684597512e6 (diff)
downloadgit-bc88defa2f9f92324106dca48126039246ab00e1.tar.gz
Merge branch 'mb/local-clone-after-applying-insteadof'
Apply the "if cloning from a local disk, physically copy repository using hardlinks, unless otherwise told not to with --no-local" optimization when url.*.insteadOf mechanism rewrites a "git clone $URL" that refers to a repository over the network to a clone from a local disk. * mb/local-clone-after-applying-insteadof: use local cloning if insteadOf makes a local URL
-rw-r--r--builtin/clone.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index f0dabecca8..bbd169ceb4 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -799,18 +799,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
die(_("repository '%s' does not exist"), repo_name);
else
repo = repo_name;
- is_local = option_local != 0 && path && !is_bundle;
- if (is_local) {
- if (option_depth)
- warning(_("--depth is ignored in local clones; use file:// instead."));
- if (!access(mkpath("%s/shallow", path), F_OK)) {
- if (option_local > 0)
- warning(_("source repository is shallow, ignoring --local"));
- is_local = 0;
- }
- }
- if (option_local > 0 && !is_local)
- warning(_("--local is ignored"));
/* no need to be strict, transport_set_option() will validate it again */
if (option_depth && atoi(option_depth) < 1)
@@ -903,6 +891,19 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
remote = remote_get(option_origin);
transport = transport_get(remote, remote->url[0]);
+ path = get_repo_path(remote->url[0], &is_bundle);
+ is_local = option_local != 0 && path && !is_bundle;
+ if (is_local) {
+ if (option_depth)
+ warning(_("--depth is ignored in local clones; use file:// instead."));
+ if (!access(mkpath("%s/shallow", path), F_OK)) {
+ if (option_local > 0)
+ warning(_("source repository is shallow, ignoring --local"));
+ is_local = 0;
+ }
+ }
+ if (option_local > 0 && !is_local)
+ warning(_("--local is ignored"));
transport->cloning = 1;
if (!transport->get_refs_list || (!is_local && !transport->fetch))