Skip to content

Commit eca143b

Browse files
committed
Merge branch 'me/fetch-into-shallow-safety' into maint
"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 697f67a + eb86a50 commit eca143b

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
@@ -790,7 +790,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
790790
sort_ref_list(&ref, ref_compare_name);
791791
qsort(sought, nr_sought, sizeof(*sought), cmp_ref_by_name);
792792

793-
if (is_repository_shallow() && !server_supports("shallow"))
793+
if ((args->depth > 0 || is_repository_shallow()) && !server_supports("shallow"))
794794
die("Server does not support shallow clients");
795795
if (server_supports("multi_ack_detailed")) {
796796
if (args->verbose)

0 commit comments

Comments
 (0)