Skip to content

Commit

Permalink
Merge branch 'nd/clone-depth-zero'
Browse files Browse the repository at this point in the history
* nd/clone-depth-zero:
  clone: warn users --depth is ignored in local clones
  • Loading branch information
Junio C Hamano committed Sep 3, 2010
2 parents f9c8e7c + 24c61c4 commit c6babe5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions builtin/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit c6babe5

Please sign in to comment.