Skip to content

Commit 58eb012

Browse files
committed
Merge branch 'me/fetch-into-shallow-safety'
"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
2 parents d70bc3b + eb86a50 commit 58eb012

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fetch-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
809809
sort_ref_list(&ref, ref_compare_name);
810810
qsort(sought, nr_sought, sizeof(*sought), cmp_ref_by_name);
811811

812-
if (is_repository_shallow() && !server_supports("shallow"))
812+
if ((args->depth > 0 || is_repository_shallow()) && !server_supports("shallow"))
813813
die("Server does not support shallow clients");
814814
if (server_supports("multi_ack_detailed")) {
815815
if (args->verbose)

0 commit comments

Comments
 (0)