summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/transport-helper.c b/transport-helper.c
index 5f6e0b3bd8..a0297b0986 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -671,8 +671,8 @@ static int connect_helper(struct transport *transport, const char *name,
static struct ref *get_refs_list_using_list(struct transport *transport,
int for_push);
-static int fetch(struct transport *transport,
- int nr_heads, struct ref **to_fetch)
+static int fetch_refs(struct transport *transport,
+ int nr_heads, struct ref **to_fetch)
{
struct helper_data *data = transport->data;
int i, count;
@@ -681,7 +681,17 @@ static int fetch(struct transport *transport,
if (process_connect(transport, 0)) {
do_take_over(transport);
- return transport->vtable->fetch(transport, nr_heads, to_fetch);
+ return transport->vtable->fetch_refs(transport, nr_heads, to_fetch);
+ }
+
+ /*
+ * If we reach here, then the server, the client, and/or the transport
+ * helper does not support protocol v2. --negotiate-only requires
+ * protocol v2.
+ */
+ if (data->transport_options.acked_commits) {
+ warning(_("--negotiate-only requires protocol v2"));
+ return -1;
}
if (!data->get_refs_list_called)
@@ -745,13 +755,13 @@ static int push_update_ref_status(struct strbuf *buf,
die(_("'option' without a matching 'ok/error' directive"));
if (state->new_report) {
if (!state->hint->report) {
- state->hint->report = xcalloc(1, sizeof(struct ref_push_report));
+ CALLOC_ARRAY(state->hint->report, 1);
state->report = state->hint->report;
} else {
state->report = state->hint->report;
while (state->report->next)
state->report = state->report->next;
- state->report->next = xcalloc(1, sizeof(struct ref_push_report));
+ CALLOC_ARRAY(state->report->next, 1);
state->report = state->report->next;
}
state->new_report = 0;
@@ -835,6 +845,10 @@ static int push_update_ref_status(struct strbuf *buf,
forced = 1;
FREE_AND_NULL(msg);
}
+ else if (!strcmp(msg, "expecting report")) {
+ status = REF_STATUS_EXPECTING_REPORT;
+ FREE_AND_NULL(msg);
+ }
}
if (state->hint)
@@ -1162,13 +1176,14 @@ static int has_attribute(const char *attrs, const char *attr)
}
static struct ref *get_refs_list(struct transport *transport, int for_push,
- const struct strvec *ref_prefixes)
+ struct transport_ls_refs_options *transport_options)
{
get_helper(transport);
if (process_connect(transport, for_push)) {
do_take_over(transport);
- return transport->vtable->get_refs_list(transport, for_push, ref_prefixes);
+ return transport->vtable->get_refs_list(transport, for_push,
+ transport_options);
}
return get_refs_list_using_list(transport, for_push);
@@ -1250,12 +1265,12 @@ static struct ref *get_refs_list_using_list(struct transport *transport,
}
static struct transport_vtable vtable = {
- set_helper_option,
- get_refs_list,
- fetch,
- push_refs,
- connect_helper,
- release_helper
+ .set_option = set_helper_option,
+ .get_refs_list = get_refs_list,
+ .fetch_refs = fetch_refs,
+ .push_refs = push_refs,
+ .connect = connect_helper,
+ .disconnect = release_helper
};
int transport_helper_init(struct transport *transport, const char *name)