@matheusbsbs / matheus-bagliano / commits / 1f5881bb5f
Fork 0

fix multi_ack.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>

Johannes Schindelin committed Oct 28, 2005 at 05:56 UTC 1f5881bb5f4da97d0bb23024ae91079137326c7e
2 files changed +10 -5
connect.c
+3 -2
@@ -8,7 +8,7 @@
8 #include <arpa/inet.h>
9 #include <netdb.h>
10
11 -static char *server_capabilities = "";
11 +static char *server_capabilities = NULL;
12
13 /*
14 * Read all the refs from the other end
@@ -58,7 +58,8 @@ struct ref **get_remote_heads(int in, struct ref **list,
58
59 int server_supports(const char *feature)
60 {
61 - return strstr(feature, server_capabilities) != NULL;
61 + return server_capabilities &&
62 + strstr(server_capabilities, feature) != NULL;
63 }
64
65 int get_ack(int fd, unsigned char *result_sha1)
upload-pack.c
+7 -3
@@ -212,11 +212,15 @@ static int receive_needs(void)
212
213 static int send_ref(const char *refname, const unsigned char *sha1)
214 {
215 - static char *capabilities = "\0multi_ack";
215 + static char *capabilities = "multi_ack";
216 struct object *o = parse_object(sha1);
217
218 - packet_write(1, "%s %s%s\n", sha1_to_hex(sha1), refname, capabilities);
219 - capabilities = "";
218 + if (capabilities)
219 + packet_write(1, "%s %s%c%s\n", sha1_to_hex(sha1), refname,
220 + 0, capabilities);
221 + else
222 + packet_write(1, "%s %s\n", sha1_to_hex(sha1), refname);
223 + capabilities = NULL;
224 if (!(o->flags & OUR_REF)) {
225 o->flags |= OUR_REF;
226 nr_our_refs++;