Skip to content

Commit

Permalink
transport-helper: ask the helper to set the same options for import a…
Browse files Browse the repository at this point in the history
…s 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>
  • Loading branch information
Mike Hommey authored and Junio C Hamano committed Feb 13, 2015
1 parent 2879bc3 commit aab1beb
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions transport-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,16 +342,6 @@ static int fetch_with_fetch(struct transport *transport,
int i;
struct strbuf buf = STRBUF_INIT;

if (data->check_connectivity &&
data->transport_options.check_self_contained_and_connected)
set_helper_option(transport, "check-connectivity", "true");

if (transport->cloning)
set_helper_option(transport, "cloning", "true");

if (data->transport_options.update_shallow)
set_helper_option(transport, "update-shallow", "true");

for (i = 0; i < nr_heads; i++) {
const struct ref *posn = to_fetch[i];
if (posn->status & REF_STATUS_UPTODATE)
Expand Down Expand Up @@ -622,6 +612,16 @@ static int fetch(struct transport *transport,
if (!count)
return 0;

if (data->check_connectivity &&
data->transport_options.check_self_contained_and_connected)
set_helper_option(transport, "check-connectivity", "true");

if (transport->cloning)
set_helper_option(transport, "cloning", "true");

if (data->transport_options.update_shallow)
set_helper_option(transport, "update-shallow", "true");

if (data->fetch)
return fetch_with_fetch(transport, nr_heads, to_fetch);

Expand Down

0 comments on commit aab1beb

Please sign in to comment.