git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clone: check if server supports shallow clones
@ 2015-06-10 18:35 Mike Edgar
  2015-06-10 19:05 ` Jeff King
  0 siblings, 1 reply; 12+ messages in thread
From: Mike Edgar @ 2015-06-10 18:35 UTC (permalink / raw)
  To: git; +Cc: peff, pclouds, Mike Edgar

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.

Signed-off-by: Mike Edgar <adgar@google.com>
---
 builtin/clone.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/builtin/clone.c b/builtin/clone.c
index b878252..b4e9846 100644
--- 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"));
+
 	if (refs) {
 		mapped_refs = wanted_peer_refs(refs, refspec);
 		/*
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-06-17 17:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-10 18:35 [PATCH] clone: check if server supports shallow clones Mike Edgar
2015-06-10 19:05 ` Jeff King
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

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).