Skip to content

Commit aab1beb

Browse files
glandiumgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2879bc3 commit aab1beb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

transport-helper.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -342,16 +342,6 @@ static int fetch_with_fetch(struct transport *transport,
342342
int i;
343343
struct strbuf buf = STRBUF_INIT;
344344

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-
355345
for (i = 0; i < nr_heads; i++) {
356346
const struct ref *posn = to_fetch[i];
357347
if (posn->status & REF_STATUS_UPTODATE)
@@ -622,6 +612,16 @@ static int fetch(struct transport *transport,
622612
if (!count)
623613
return 0;
624614

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+
625625
if (data->fetch)
626626
return fetch_with_fetch(transport, nr_heads, to_fetch);
627627

0 commit comments

Comments
 (0)