From: Johannes Schindelin Date: Fri, 28 Oct 2005 03:56:41 +0000 (+0200) Subject: fix multi_ack. X-Git-Tag: v0.99.9~6 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=1f5881bb5f4da97d0bb23024ae91079137326c7e;p=git.git fix multi_ack. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- diff --git a/connect.c b/connect.c index b8aea351..c2badc71 100644 --- a/connect.c +++ b/connect.c @@ -8,7 +8,7 @@ #include #include -static char *server_capabilities = ""; +static char *server_capabilities = NULL; /* * Read all the refs from the other end @@ -58,7 +58,8 @@ struct ref **get_remote_heads(int in, struct ref **list, int server_supports(const char *feature) { - return strstr(feature, server_capabilities) != NULL; + return server_capabilities && + strstr(server_capabilities, feature) != NULL; } int get_ack(int fd, unsigned char *result_sha1) diff --git a/upload-pack.c b/upload-pack.c index 686445ec..c5eff213 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -212,11 +212,15 @@ static int receive_needs(void) static int send_ref(const char *refname, const unsigned char *sha1) { - static char *capabilities = "\0multi_ack"; + static char *capabilities = "multi_ack"; struct object *o = parse_object(sha1); - packet_write(1, "%s %s%s\n", sha1_to_hex(sha1), refname, capabilities); - capabilities = ""; + if (capabilities) + packet_write(1, "%s %s%c%s\n", sha1_to_hex(sha1), refname, + 0, capabilities); + else + packet_write(1, "%s %s\n", sha1_to_hex(sha1), refname); + capabilities = NULL; if (!(o->flags & OUR_REF)) { o->flags |= OUR_REF; nr_our_refs++;