All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Mike Edgar <adgar@google.com>
Cc: git@vger.kernel.org, pclouds@gmail.com
Subject: Re: [PATCH] clone: check if server supports shallow clones
Date: Wed, 10 Jun 2015 15:05:14 -0400	[thread overview]
Message-ID: <20150610190512.GB22800@peff.net> (raw)
In-Reply-To: <1433961320-1366-1-git-send-email-adgar@google.com>

On Wed, Jun 10, 2015 at 02:35:20PM -0400, Mike Edgar wrote:

> When the user passes --depth to git-clone 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 git-clone can
> exit with a helpful error if necessary.

This sounds like a good thing to do, but...

> --- a/builtin/clone.c
> +++ b/builtin/clone.c
> @@ -944,6 +944,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
>  
>  	refs = transport_get_remote_refs(transport);
>  
> +	if (option_depth && !is_local && !server_supports("shallow"))
> +		die(_("Server does not support shallow clients"));
> +

It feels a little weird to be checking the option here in cmd_clone.
The transport layer knows we have specified a depth, so it seems like a
more natural place for it (or possibly even lower, in the actual
git-protocol code).

That being said, I think the current capabilities handling is a bit
messy and crosses module boundaries freely. So I would not be surprised
if this is the most reasonable place to put it. But it does make me
wonder whether "git fetch --depth=..." needs the same treatment.

I see that do_fetch_pack checks server_supports("shallow"). Is that
enough to cover all fetch cases? And if it is, why does it not cover the
matching clone cases?

-Peff

  reply	other threads:[~2015-06-10 19:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-10 18:35 [PATCH] clone: check if server supports shallow clones Mike Edgar
2015-06-10 19:05 ` Jeff King [this message]
2015-06-10 20:25   ` Michael Edgar
2015-06-10 20:56     ` Jeff King
2015-06-11 13:02   ` Duy Nguyen
2015-06-11 14:32     ` Jeff King
2015-06-11 18:18       ` Michael Edgar
2015-06-11 20:44         ` 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
2015-06-17 16:35       ` [PATCH] clone: check if server supports shallow clones Junio C Hamano
2015-06-17 16:59         ` 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=20150610190512.GB22800@peff.net \
    --to=peff@peff.net \
    --cc=adgar@google.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.