diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-06-21 14:41:53 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-06-21 14:41:53 -0700 |
commit | 486fcbc458ecb1ee906dcb67a8a7bfe933614111 (patch) | |
tree | 82f3cc51ee866448684b81ecebfb82603533bc36 /builtin | |
parent | cf5c75d3ea0541bf7fe8ef89938f54a491edc023 (diff) | |
parent | 189260b190be845f0e24ede93f9ac539627d72fa (diff) | |
download | git-486fcbc458ecb1ee906dcb67a8a7bfe933614111.tar.gz |
Merge branch 'jk/clone-local'
"git clone --local $path" started its life as an experiment to
optionally use link/copy when cloning a repository on the disk, but
we didn't deprecate it after we made the option a no-op to always
use the optimization.
The command learns "--no-local" option to turn this off, as a more
explicit alternative over use of file:// URL.
* jk/clone-local:
clone: allow --no-local to turn off local optimizations
docs/clone: mention that --local may be ignored
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/clone.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/builtin/clone.c b/builtin/clone.c index a4d8d25ee3..7f3b9823ce 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -38,7 +38,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, option_no_hardlinks, option_shared, option_recursive; +static int option_local = -1, option_no_hardlinks, option_shared, option_recursive; static char *option_template, *option_depth; static char *option_origin = NULL; static char *option_branch = NULL; @@ -70,8 +70,8 @@ static struct option builtin_clone_options[] = { PARSE_OPT_NOARG | PARSE_OPT_HIDDEN }, OPT_BOOLEAN(0, "mirror", &option_mirror, "create a mirror repository (implies bare)"), - OPT_BOOLEAN('l', "local", &option_local, - "to clone from a local repository"), + OPT_BOOL('l', "local", &option_local, + "to clone from a local repository"), OPT_BOOLEAN(0, "no-hardlinks", &option_no_hardlinks, "don't use local hardlinks, always copy"), OPT_BOOLEAN('s', "shared", &option_shared, @@ -342,7 +342,7 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest, if (!option_no_hardlinks) { if (!link(src->buf, dest->buf)) continue; - if (option_local) + if (option_local > 0) die_errno(_("failed to create link '%s'"), dest->buf); option_no_hardlinks = 1; } @@ -668,7 +668,7 @@ 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 = path && !is_bundle; + is_local = option_local != 0 && path && !is_bundle; if (is_local && option_depth) warning(_("--depth is ignored in local clones; use file:// instead.")); |