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>
This commit is contained in:
parent
f9c3360570
commit
24c61c44e6
@ -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 cmd_clone(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
int is_bundle = 0;
|
int is_bundle = 0, is_local;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
const char *repo_name, *repo, *work_tree, *git_dir;
|
const char *repo_name, *repo, *work_tree, *git_dir;
|
||||||
char *path, *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));
|
repo = xstrdup(make_absolute_path(repo_name));
|
||||||
else
|
else
|
||||||
repo = repo_name;
|
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)
|
if (argc == 2)
|
||||||
dir = xstrdup(argv[1]);
|
dir = xstrdup(argv[1]);
|
||||||
@ -514,7 +517,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
|||||||
|
|
||||||
strbuf_reset(&value);
|
strbuf_reset(&value);
|
||||||
|
|
||||||
if (path && !is_bundle) {
|
if (is_local) {
|
||||||
refs = clone_local(path, git_dir);
|
refs = clone_local(path, git_dir);
|
||||||
mapped_refs = wanted_peer_refs(refs, refspec);
|
mapped_refs = wanted_peer_refs(refs, refspec);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user