* [PATCH v2] fetch-pack: check for shallow if depth given
2015-06-11 20:44 [PATCH] clone: check if server supports shallow clones Junio C Hamano
@ 2015-06-17 11:48 ` Mike Edgar
2015-06-17 17:00 ` Jeff King
0 siblings, 1 reply; 3+ messages in thread
From: Mike Edgar @ 2015-06-17 11:48 UTC (permalink / raw)
To: git; +Cc: peff, pclouds, Mike Edgar
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>
---
fetch-pack.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fetch-pack.c b/fetch-pack.c
index a912935..a136772 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -809,7 +809,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.2.0.rc0.207.ga3a616c
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] fetch-pack: check for shallow if depth given
2015-06-17 11:48 ` [PATCH v2] fetch-pack: check for shallow if depth given Mike Edgar
@ 2015-06-17 17:00 ` Jeff King
0 siblings, 0 replies; 3+ messages in thread
From: Jeff King @ 2015-06-17 17:00 UTC (permalink / raw)
To: Mike Edgar; +Cc: git, pclouds
On Wed, Jun 17, 2015 at 07:48:14AM -0400, Mike Edgar wrote:
> 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>
Looks good to me.
-Peff
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] fetch-pack: check for shallow if depth given
@ 2015-06-18 0:31 Mike Edgar
0 siblings, 0 replies; 3+ messages in thread
From: Mike Edgar @ 2015-06-18 0:31 UTC (permalink / raw)
To: gitster; +Cc: git, Mike Edgar
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-18 0:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-18 0:31 [PATCH v2] fetch-pack: check for shallow if depth given Mike Edgar
-- 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
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).