#include <arpa/inet.h>
#include <netdb.h>
+static char *server_capabilities = NULL;
+
/*
* Read all the refs from the other end
*/
unsigned char old_sha1[20];
static char buffer[1000];
char *name;
- int len;
+ int len, name_len;
len = packet_read_line(in, buffer, sizeof(buffer));
if (!len)
check_ref_format(name + 5))
continue;
+ name_len = strlen(name);
+ if (len != name_len + 41) {
+ if (server_capabilities)
+ free(server_capabilities);
+ server_capabilities = strdup(name + name_len + 1);
+ }
+
if (nr_match && !path_match(name, nr_match, match))
continue;
ref = xcalloc(1, sizeof(*ref) + len - 40);
return list;
}
+int server_supports(const char *feature)
+{
+ return server_capabilities &&
+ strstr(server_capabilities, feature) != NULL;
+}
+
int get_ack(int fd, unsigned char *result_sha1)
{
static char line[1000];