summaryrefslogtreecommitdiff
path: root/builtin/clone.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-08-23 12:08:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-08-24 16:28:02 (GMT)
commit24c61c44e65f672ffcd032e43519824719d249c4 (patch)
treea78a069f9a9b9d743fc7fb0d5590edb585361f4d /builtin/clone.c
parentf9c33605700e37b75279ed6ce4bffaad3eb0cf10 (diff)
downloadgit-24c61c44e65f672ffcd032e43519824719d249c4.zip
git-24c61c44e65f672ffcd032e43519824719d249c4.tar.gz
git-24c61c44e65f672ffcd032e43519824719d249c4.tar.bz2
clone: warn users --depth is ignored in local clones
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/clone.c')
-rw-r--r--builtin/clone.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index efb1e6f..19ed640 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -361,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;
@@ -414,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]);
@@ -514,7 +517,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
strbuf_reset(&value);
- if (path && !is_bundle) {
+ if (is_local) {
refs = clone_local(path, git_dir);
mapped_refs = wanted_peer_refs(refs, refspec);
} else {