Browse Source

fix multi_ack.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
maint
Johannes Schindelin 19 years ago committed by Junio C Hamano
parent
commit
1f5881bb5f
  1. 5
      connect.c
  2. 10
      upload-pack.c

5
connect.c

@ -8,7 +8,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>


static char *server_capabilities = ""; static char *server_capabilities = NULL;


/* /*
* Read all the refs from the other end * 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) 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) int get_ack(int fd, unsigned char *result_sha1)

10
upload-pack.c

@ -212,11 +212,15 @@ static int receive_needs(void)


static int send_ref(const char *refname, const unsigned char *sha1) 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); struct object *o = parse_object(sha1);


packet_write(1, "%s %s%s\n", sha1_to_hex(sha1), refname, capabilities); if (capabilities)
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)) { if (!(o->flags & OUR_REF)) {
o->flags |= OUR_REF; o->flags |= OUR_REF;
nr_our_refs++; nr_our_refs++;

Loading…
Cancel
Save