X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=connect.c;h=57e25a34bcd7cfc8aa0f2694286c5e9cb3b145ae;hb=40a10462498bdd23d4e49f02867b8be50eb78704;hp=b157cf1cc718bbd7b8f4598b2dcb3a7ba92bb8e3;hpb=b12bbd5986e1fae4120d7a415c1271c0273cad7e;p=git.git diff --git a/connect.c b/connect.c index b157cf1c..57e25a34 100644 --- a/connect.c +++ b/connect.c @@ -1,6 +1,7 @@ #include "cache.h" #include "pkt-line.h" #include "quote.h" +#include "refs.h" #include #include #include @@ -10,7 +11,8 @@ /* * Read all the refs from the other end */ -struct ref **get_remote_heads(int in, struct ref **list, int nr_match, char **match) +struct ref **get_remote_heads(int in, struct ref **list, + int nr_match, char **match, int ignore_funny) { *list = NULL; for (;;) { @@ -29,6 +31,11 @@ struct ref **get_remote_heads(int in, struct ref **list, int nr_match, char **ma if (len < 42 || get_sha1_hex(buffer, old_sha1) || buffer[40] != ' ') die("protocol error: expected sha/ref, got '%s'", buffer); name = buffer + 41; + + if (ignore_funny && 45 < len && !memcmp(name, "refs/", 5) && + check_ref_format(name + 5)) + continue; + if (nr_match && !path_match(name, nr_match, match)) continue; ref = xcalloc(1, sizeof(*ref) + len - 40); @@ -52,8 +59,11 @@ int get_ack(int fd, unsigned char *result_sha1) if (!strcmp(line, "NAK")) return 0; if (!strncmp(line, "ACK ", 3)) { - if (!get_sha1_hex(line+4, result_sha1)) + if (!get_sha1_hex(line+4, result_sha1)) { + if (strstr(line+45, "continue")) + return 2; return 1; + } } die("git-fetch_pack: expected ACK/NAK, got '%s'", line); } @@ -284,6 +294,10 @@ static enum protocol get_protocol(const char *name) return PROTO_SSH; if (!strcmp(name, "git")) return PROTO_GIT; + if (!strcmp(name, "git+ssh")) + return PROTO_SSH; + if (!strcmp(name, "ssh+git")) + return PROTO_SSH; die("I don't handle protocol '%s'", name); }