return 0;
}
+static void die_if_server_options(struct transport *transport)
+{
+ if (!transport->server_options || !transport->server_options->nr)
+ return;
+ advise(_("see protocol.version in 'git help config' for more details"));
+ die(_("server options require protocol version 2 or later"));
+}
+
/*
* Obtains the protocol version from the transport and writes it to
* transport->data->version, first connecting if not already connected.
break;
case protocol_v1:
case protocol_v0:
+ die_if_server_options(transport);
get_remote_heads(&reader, &refs,
for_push ? REF_NORMAL : 0,
&data->extra_have,
int ret = 0;
struct git_transport_data *data = transport->data;
struct ref *refs = NULL;
- char *dest = xstrdup(transport->url);
struct fetch_pack_args args;
struct ref *refs_tmp = NULL;
switch (data->version) {
case protocol_v2:
- refs = fetch_pack(&args, data->fd, data->conn,
+ refs = fetch_pack(&args, data->fd,
refs_tmp ? refs_tmp : transport->remote_refs,
- dest, to_fetch, nr_heads, &data->shallow,
+ to_fetch, nr_heads, &data->shallow,
&transport->pack_lockfile, data->version);
break;
case protocol_v1:
case protocol_v0:
- refs = fetch_pack(&args, data->fd, data->conn,
+ die_if_server_options(transport);
+ refs = fetch_pack(&args, data->fd,
refs_tmp ? refs_tmp : transport->remote_refs,
- dest, to_fetch, nr_heads, &data->shallow,
+ to_fetch, nr_heads, &data->shallow,
&transport->pack_lockfile, data->version);
break;
case protocol_unknown_version:
free_refs(refs_tmp);
free_refs(refs);
- free(dest);
return ret;
}
proc.argv = argv;
proc.in = -1;
+ proc.trace2_hook_name = "pre-push";
if (start_command(&proc)) {
finish_command(&proc);