[PATCH] fix multi_ack, was Re: [PATCH 8/8] git-fetch-pack: Support multi_ack extension
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Oct 28, 2005, 03:56 UTC
- Message-ID
- <Pine.LNX.4.63.0510280555070.5054@wbgn013.biozentrum.uni-wuerzburg.de>
- In-Reply-To
- <Pine.LNX.4.63.0510280535480.1460@wbgn013.biozentrum.uni-wuerzburg.de>
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> ---
I was already half asleep when I realized that
printf("%s", "\0multi_ack");could not work. All the more astounding, that my tests said that the server has multi_ack capability. But that was my mixing up arguments to strstr().
Aargh.
On Fri, 28 Oct 2005, Johannes Schindelin wrote:
> never mind patch 7 and 8. I succeeded in fscking up again. > Will patch tomorrow.
Well, I could not sleep with such silly a bug.
connect.c | 5 +++-- upload-pack.c | 10 +++++++--- 2 files changed, 10 insertions(+), 5 deletions(-)
applies-to: c45879487343238adc4e926abf0e6280a3f4291c 2c3e9bb8ab663976132315c970c0feea5176fb81
diff --git a/connect.c b/connect.c index b8aea35..c2badc7 100644 --- a/connect.c +++ b/connect.c @@ -8,7 +8,7 @@ #include <arpa/inet.h> #include <netdb.h> -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, st 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 686445e..c5eff21 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++; --- 0.99.8.GIT