Skip to content

Commit

Permalink
Merge branch 'me/fetch-into-shallow-safety'
Browse files Browse the repository at this point in the history
"git fetch --depth=<depth>" and "git clone --depth=<depth>" issued
a shallow transfer request even to an upload-pack that does not
support the capability.

* me/fetch-into-shallow-safety:
  fetch-pack: check for shallow if depth given
  • Loading branch information
Junio C Hamano committed Jul 1, 2015
2 parents d70bc3b + eb86a50 commit 58eb012
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
sort_ref_list(&ref, ref_compare_name);
qsort(sought, nr_sought, sizeof(*sought), cmp_ref_by_name);

if (is_repository_shallow() && !server_supports("shallow"))
if ((args->depth > 0 || is_repository_shallow()) && !server_supports("shallow"))
die("Server does not support shallow clients");
if (server_supports("multi_ack_detailed")) {
if (args->verbose)
Expand Down

0 comments on commit 58eb012

Please sign in to comment.