transport-helper: ask the helper to set the same options for import as for fetch
A remote helper is currently only told about the 'check-connectivity', 'cloning', and 'update-shallow' options when it supports the 'fetch' command, but not when it supports 'import' instead. This is especially important for the 'cloning' option, because it means a remote helper that only supports 'import' can't distinguish between a clone and a pull besides doing some assumptions from the git directory state. Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Mike Hommey committed
Feb 13, 2015 at 14:24 UTC
aab1beb0e1a66d31b0a9896e8c13009dece0aa45
1 file changed
+10
-10
transport-helper.c
+10
-10
@@ -342,16 +342,6 @@ static int fetch_with_fetch(struct transport *transport,
342
int i;
343
struct strbuf buf = STRBUF_INIT;
344
345
- if (data->check_connectivity &&
346
- data->transport_options.check_self_contained_and_connected)
347
- set_helper_option(transport, "check-connectivity", "true");
348
-
349
- if (transport->cloning)
350
- set_helper_option(transport, "cloning", "true");
351
-
352
- if (data->transport_options.update_shallow)
353
- set_helper_option(transport, "update-shallow", "true");
354
-
345
for (i = 0; i < nr_heads; i++) {
346
const struct ref *posn = to_fetch[i];
347
if (posn->status & REF_STATUS_UPTODATE)
@@ -622,6 +612,16 @@ static int fetch(struct transport *transport,
612
if (!count)
613
return 0;
614
615
+ if (data->check_connectivity &&
616
+ data->transport_options.check_self_contained_and_connected)
617
+ set_helper_option(transport, "check-connectivity", "true");
618
+
619
+ if (transport->cloning)
620
+ set_helper_option(transport, "cloning", "true");
621
+
622
+ if (data->transport_options.update_shallow)
623
+ set_helper_option(transport, "update-shallow", "true");
624
+
625
if (data->fetch)
626
return fetch_with_fetch(transport, nr_heads, to_fetch);
627