#include "strbuf.h"
#include "version.h"
#include "protocol.h"
+#include "alias.h"
static char *server_capabilities_v1;
static struct argv_array server_capabilities_v2 = ARGV_ARRAY_INIT;
return check_ref(ref->name, flags);
}
-static void die_initial_contact(int unexpected)
+static NORETURN void die_initial_contact(int unexpected)
{
/*
* A hang-up after seeing some response from the other end
struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
struct ref **list, int for_push,
- const struct argv_array *ref_prefixes)
+ const struct argv_array *ref_prefixes,
+ const struct string_list *server_options)
{
int i;
*list = NULL;
if (server_supports_v2("agent", 0))
packet_write_fmt(fd_out, "agent=%s", git_user_agent_sanitized());
+ if (server_options && server_options->nr &&
+ server_supports_v2("server-option", 1))
+ for (i = 0; i < server_options->nr; i++)
+ packet_write_fmt(fd_out, "server-option=%s",
+ server_options->items[i].string);
+
packet_delim(fd_out);
/* When pushing we don't want to request the peeled tags */
if (!for_push)
enum protocol protocol;
enum protocol_version version = get_protocol_version_config();
+ /*
+ * NEEDSWORK: If we are trying to use protocol v2 and we are planning
+ * to perform a push, then fallback to v0 since the client doesn't know
+ * how to push yet using v2.
+ */
+ if (version == protocol_v2 && !strcmp("git-receive-pack", prog))
+ version = protocol_v0;
+
/* Without this we cannot rely on waitpid() to tell
* what happened to our children.
*/