git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] fetch-pack: check for shallow if depth given

From
Mike Edgar <adgar@google.com>
Date
Jun 18, 2015, 00:31 UTC
Message-ID
<1434587464-18337-1-git-send-email-adgar@google.com>

When a repository is first fetched as a shallow clone, either by git-clone or by fetching into an empty repo, the server's capabilities are not currently consulted. The client will send shallow requests even if the server does not understand them, and the resulting error may be unhelpful to the user. This change pre-emptively checks so we can exit with a helpful error if necessary.

Signed-off-by: Mike Edgar <adgar@google.com>
Acked-by: Jeff King <peff@peff.net>
---
 fetch-pack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fetch-pack.c b/fetch-pack.c
index 48526aa..849a9d6 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -790,7 +790,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)
-- 
2.4.3.573.g4eafbef
Message 1 of 1 in “fetch-pack: check for shallow if depth given”
  1. fetch-pack: check for shallow if depth givenMike Edgar, Jun 18, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.