git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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
Previous: Johannes Schindelin
Message 3 of 3 in “git-fetch-pack: Support multi_ack extension”
  1. 8/8 git-fetch-pack: Support multi_ack extensionJohannes Schindelin, Oct 28, 2005
  2. Johannes SchindelinOct 28, 2005
  3. fix multi_ack, was Re: [PATCH 8/8] git-fetch-pack: Support multi_ack extensionJohannes Schindelin, Oct 28, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.