{"thread":{"id":"39665","subject":"[PATCH v2] fetch-pack: check for shallow if depth given","startedAt":"2015-06-18T00:31:04Z","lastAt":"2015-06-18T00:31:04Z","messageCount":1,"participants":["Mike Edgar"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"264104","messageId":"1434587464-18337-1-git-send-email-adgar@google.com","threadId":"39665","inReplyTo":null,"subject":"[PATCH v2] fetch-pack: check for shallow if depth given","fromName":"Mike Edgar","fromEmail":"adgar@google.com","sentAt":"2015-06-18T00:31:04Z","receivedAt":"2015-06-18T00:31:04Z","isPatch":true,"sender":{"key":"adgar@google.com","avatar":"https://avatars.githubusercontent.com/u/65914?v=4"},"body":"When a repository is first fetched as a shallow clone, either by\ngit-clone or by fetching into an empty repo, the server's capabilities\nare not currently consulted. The client will send shallow requests even\nif the server does not understand them, and the resulting error may be\nunhelpful to the user. This change pre-emptively checks so we can exit\nwith a helpful error if necessary.\n\nSigned-off-by: Mike Edgar <adgar@google.com>\nAcked-by: Jeff King <peff@peff.net>\n---\n fetch-pack.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 48526aa..849a9d6 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -790,7 +790,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,\n \tsort_ref_list(&ref, ref_compare_name);\n \tqsort(sought, nr_sought, sizeof(*sought), cmp_ref_by_name);\n \n-\tif (is_repository_shallow() && !server_supports(\"shallow\"))\n+\tif ((args->depth > 0 || is_repository_shallow()) && !server_supports(\"shallow\"))\n \t\tdie(\"Server does not support shallow clients\");\n \tif (server_supports(\"multi_ack_detailed\")) {\n \t\tif (args->verbose)\n-- \n2.4.3.573.g4eafbef\n"}]}