git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Edgar <adgar@google.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Mike Edgar <adgar@google.com>
Subject: [PATCH v2] fetch-pack: check for shallow if depth given
Date: Wed, 17 Jun 2015 20:31:04 -0400	[thread overview]
Message-ID: <1434587464-18337-1-git-send-email-adgar@google.com> (raw)

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

             reply	other threads:[~2015-06-18  0:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-18  0:31 Mike Edgar [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-06-11 20:44 [PATCH] clone: check if server supports shallow clones Junio C Hamano
2015-06-17 11:48 ` [PATCH v2] fetch-pack: check for shallow if depth given Mike Edgar
2015-06-17 17:00   ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434587464-18337-1-git-send-email-adgar@google.com \
    --to=adgar@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).