{"thread":{"id":"2197","subject":"[PATCH 4/4] git-fetch-pack: Implement client part of the multi_ack extension","startedAt":"2005-10-23T01:40:13Z","lastAt":"2005-10-26T09:16:15Z","messageCount":8,"participants":["Johannes Schindelin","Alex Riesen","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"10477","messageId":"Pine.LNX.4.63.0510230339090.21239@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2197","inReplyTo":null,"subject":"[PATCH 4/4] git-fetch-pack: Implement client part of the multi_ack extension","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-10-23T01:40:13Z","receivedAt":"2005-10-23T01:40:13Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"This patch concludes the series, which makes \ngit-fetch-pack/git-upload-pack negotiate a potentially better set of \ncommon revs. It should make a difference when fetching from a repository \nwith a few branches.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n connect.c    |    5 ++++-\n fetch-pack.c |   50 +++++++++++++++++++++++++++++++++++++-------------\n 2 files changed, 41 insertions(+), 14 deletions(-)\n\napplies-to: 6b4b7d9acf60aa99d961b599f37d0c824be79e27\n9adb6b3971e7daa79221d7dbe05b66327b266b86\ndiff --git a/connect.c b/connect.c\nindex b171c5d..57e25a3 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -59,8 +59,11 @@ int get_ack(int fd, unsigned char *resul\n \tif (!strcmp(line, \"NAK\"))\n \t\treturn 0;\n \tif (!strncmp(line, \"ACK \", 3)) {\n-\t\tif (!get_sha1_hex(line+4, result_sha1))\n+\t\tif (!get_sha1_hex(line+4, result_sha1)) {\n+\t\t\tif (strstr(line+45, \"continue\"))\n+\t\t\t\treturn 2;\n \t\t\treturn 1;\n+\t\t}\n \t}\n \tdie(\"git-fetch_pack: expected ACK/NAK, got '%s'\", line);\n }\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 3a903c4..57602b9 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -125,7 +125,7 @@ static int find_common(int fd[2], unsign\n \t\t       struct ref *refs)\n {\n \tint fetching;\n-\tint count = 0, flushes = 0, retval;\n+\tint count = 0, flushes = 0, multi_ack = 0, retval;\n \tconst unsigned char *sha1;\n \n \tfor_each_ref(rev_list_append_sha1);\n@@ -156,20 +156,22 @@ static int find_common(int fd[2], unsign\n \t\t\tcontinue;\n \t\t}\n \n-\t\tpacket_write(fd[1], \"want %s\\n\", sha1_to_hex(remote));\n+\t\tpacket_write(fd[1], \"want %s multi_ack\\n\", sha1_to_hex(remote));\n \t\tfetching++;\n \t}\n \tpacket_flush(fd[1]);\n \tif (!fetching)\n \t\treturn 1;\n \n-\tflushes = 1;\n+\tflushes = 0;\n \tretval = -1;\n \twhile ((sha1 = get_rev())) {\n \t\tpacket_write(fd[1], \"have %s\\n\", sha1_to_hex(sha1));\n \t\tif (verbose)\n \t\t\tfprintf(stderr, \"have %s\\n\", sha1_to_hex(sha1));\n \t\tif (!(31 & ++count)) {\n+\t\t\tint ack;\n+\n \t\t\tpacket_flush(fd[1]);\n \t\t\tflushes++;\n \n@@ -179,26 +181,48 @@ static int find_common(int fd[2], unsign\n \t\t\t */\n \t\t\tif (count == 32)\n \t\t\t\tcontinue;\n-\t\t\tif (get_ack(fd[0], result_sha1)) {\n-\t\t\t\tflushes = 0;\n-\t\t\t\tretval = 0;\n-\t\t\t\tif (verbose)\n-\t\t\t\t\tfprintf(stderr, \"got ack\\n\");\n-\t\t\t\tbreak;\n-\t\t\t}\n+\n+\t\t\tdo {\n+\t\t\t\tack = get_ack(fd[0], result_sha1);\n+\t\t\t\tif (verbose && ack)\n+\t\t\t\t\tfprintf(stderr, \"got ack %d %s\\n\", ack,\n+\t\t\t\t\t\t\tsha1_to_hex(result_sha1));\n+\t\t\t\tif (ack == 1) {\n+\t\t\t\t\tif (!multi_ack)\n+\t\t\t\t\t\tflushes = 0;\n+\t\t\t\t\tretval = 0;\n+\t\t\t\t\tgoto done;\n+\t\t\t\t} else if (ack == 2) {\n+\t\t\t\t\tmulti_ack = 1;\n+\t\t\t\t\tmark_common((struct commit *)\n+\t\t\t\t\t\t\tlookup_object(result_sha1));\n+\t\t\t\t\tretval = 0;\n+\t\t\t\t}\n+\t\t\t} while(ack);\n \t\t\tflushes--;\n \t\t}\n \t}\n+done:\n+\tif (multi_ack) {\n+\t\tpacket_flush(fd[1]);\n+\t\tflushes++;\n+\t}\n \tpacket_write(fd[1], \"done\\n\");\n \tif (verbose)\n \t\tfprintf(stderr, \"done\\n\");\n+\tif (retval != 0)\n+\t\tflushes++;\n \twhile (flushes) {\n-\t\tflushes--;\n \t\tif (get_ack(fd[0], result_sha1)) {\n \t\t\tif (verbose)\n-\t\t\t\tfprintf(stderr, \"got ack\\n\");\n-\t\t\treturn 0;\n+\t\t\t\tfprintf(stderr, \"got ack %s\\n\",\n+\t\t\t\t\tsha1_to_hex(result_sha1));\n+\t\t\tif (!multi_ack)\n+\t\t\t\treturn 0;\n+\t\t\tretval = 0;\n+\t\t\tcontinue;\n \t\t}\n+\t\tflushes--;\n \t}\n \treturn retval;\n }\n---\n0.99.8.GIT\n"},{"id":"10606","messageId":"20051025204754.GA8030@steel.home","threadId":"2197","inReplyTo":"Pine.LNX.4.63.0510230339090.21239@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH 4/4] git-fetch-pack: Implement client part of the multi_ack extension","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-10-25T20:47:54Z","receivedAt":"2005-10-25T20:47:54Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Johannes Schindelin, Sun, Oct 23, 2005 03:40:13 +0200:\n> This patch concludes the series, which makes \n> git-fetch-pack/git-upload-pack negotiate a potentially better set of \n> common revs. It should make a difference when fetching from a repository \n> with a few branches.\n\nThis broke git-pull for me (the local one):\n\n    /d/e/f.git$ git-pull\n    fatal: bad pack file\n    fatal: git-unpack-objects died with error code 128\n    Fetch failure: /a/b/c/.git\n\n> applies-to: 6b4b7d9acf60aa99d961b599f37d0c824be79e27\n> 9adb6b3971e7daa79221d7dbe05b66327b266b86\n...\n> diff --git a/fetch-pack.c b/fetch-pack.c\n> index 3a903c4..57602b9 100644\n> --- a/fetch-pack.c\n> +++ b/fetch-pack.c\n\nReverting just fetch-pack.c part of the patch helps.\n"},{"id":"10609","messageId":"Pine.LNX.4.63.0510252300290.15756@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2197","inReplyTo":"20051025204754.GA8030@steel.home","subject":"Re: [PATCH 4/4] git-fetch-pack: Implement client part of the multi_ack extension","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-10-25T21:02:13Z","receivedAt":"2005-10-25T21:02:13Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 25 Oct 2005, Alex Riesen wrote:\n\n> Johannes Schindelin, Sun, Oct 23, 2005 03:40:13 +0200:\n> > This patch concludes the series, which makes \n> > git-fetch-pack/git-upload-pack negotiate a potentially better set of \n> > common revs. It should make a difference when fetching from a repository \n> > with a few branches.\n> \n> This broke git-pull for me (the local one):\n> \n>     /d/e/f.git$ git-pull\n>     fatal: bad pack file\n>     fatal: git-unpack-objects died with error code 128\n>     Fetch failure: /a/b/c/.git\n> \n> > applies-to: 6b4b7d9acf60aa99d961b599f37d0c824be79e27\n> > 9adb6b3971e7daa79221d7dbe05b66327b266b86\n> ...\n> > diff --git a/fetch-pack.c b/fetch-pack.c\n> > index 3a903c4..57602b9 100644\n> > --- a/fetch-pack.c\n> > +++ b/fetch-pack.c\n> \n> Reverting just fetch-pack.c part of the patch helps.\n\nCould you please try the patch I sent with the subject \"[PATCH] \nfetch/upload: Fix corner case with few revs\"? Your output looks exactly \nlike what I fixed with that patch.\n\nCiao,\nDscho\n"},{"id":"10610","messageId":"7vvezlcnpi.fsf@assigned-by-dhcp.cox.net","threadId":"2197","inReplyTo":"20051025204754.GA8030@steel.home","subject":"Re: [PATCH 4/4] git-fetch-pack: Implement client part of the multi_ack extension","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-10-25T21:04:57Z","receivedAt":"2005-10-25T21:04:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Riesen <raa.lkml@gmail.com> writes:\n\n> Johannes Schindelin, Sun, Oct 23, 2005 03:40:13 +0200:\n>> This patch concludes the series, which makes \n>> git-fetch-pack/git-upload-pack negotiate a potentially better set of \n>> common revs. It should make a difference when fetching from a repository \n>> with a few branches.\n>\n> This broke git-pull for me (the local one):\n\nIs this the same problem I fixed with this commit, which sits at\nthe tip on the \"master\" branch?\n\ncommit 7efc8e43508b415e2540dbcb79521bde16c51e0c\ntree 6234aa4f7095054a137e030030f914dc6633f809\nparent 40a10462498bdd23d4e49f02867b8be50eb78704\nauthor Junio C Hamano <junkio@cox.net> 1130061738 -0700\ncommitter Junio C Hamano <junkio@cox.net> 1130192018 -0700\n\n    upload-pack: fix thinko in common-commit finder code.\n\n    The code to check if we have the object the other side has was bogus\n    (my fault).\n\n    Signed-off-by: Junio C Hamano <junkio@cox.net>\n"},{"id":"10611","messageId":"Pine.LNX.4.63.0510252323110.18248@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2197","inReplyTo":"7vvezlcnpi.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 4/4] git-fetch-pack: Implement client part of the multi_ack extension","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-10-25T21:26:49Z","receivedAt":"2005-10-25T21:26:49Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 25 Oct 2005, Junio C Hamano wrote:\n\n> Alex Riesen <raa.lkml@gmail.com> writes:\n> \n> > Johannes Schindelin, Sun, Oct 23, 2005 03:40:13 +0200:\n> >> This patch concludes the series, which makes \n> >> git-fetch-pack/git-upload-pack negotiate a potentially better set of \n> >> common revs. It should make a difference when fetching from a repository \n> >> with a few branches.\n> >\n> > This broke git-pull for me (the local one):\n> \n> Is this the same problem I fixed with this commit, which sits at\n> the tip on the \"master\" branch?\n> \n> commit 7efc8e43508b415e2540dbcb79521bde16c51e0c\n> tree 6234aa4f7095054a137e030030f914dc6633f809\n> parent 40a10462498bdd23d4e49f02867b8be50eb78704\n> author Junio C Hamano <junkio@cox.net> 1130061738 -0700\n> committer Junio C Hamano <junkio@cox.net> 1130192018 -0700\n> \n>     upload-pack: fix thinko in common-commit finder code.\n> \n>     The code to check if we have the object the other side has was bogus\n>     (my fault).\n> \n>     Signed-off-by: Junio C Hamano <junkio@cox.net>\n\nIt looks to me like it is not. This looks more like upload-pack speaks \nmulti_ack, but fetch-pack does not, since it gets the \"got ack .. \ncontinue\" too late.\n\nI'll send out a patch implementing a first version of my \"nasty\" \nfetch-pack tests in a few minutes. This test showed me my error.\n\nCiao,\nDscho\n"},{"id":"10641","messageId":"81b0412b0510252346t3806892dx71f9c0dc1efe4073@mail.gmail.com","threadId":"2197","inReplyTo":"Pine.LNX.4.63.0510252300290.15756@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH 4/4] git-fetch-pack: Implement client part of the multi_ack extension","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-10-26T06:46:11Z","receivedAt":"2005-10-26T06:46:11Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 10/25/05, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> > > This patch concludes the series, which makes\n> > > git-fetch-pack/git-upload-pack negotiate a potentially better set of\n> > > common revs. It should make a difference when fetching from a repository\n> > > with a few branches.\n> >\n> > This broke git-pull for me (the local one):\n> >\n> >     /d/e/f.git$ git-pull\n> >     fatal: bad pack file\n> >     fatal: git-unpack-objects died with error code 128\n> >     Fetch failure: /a/b/c/.git\n> >\n> > > applies-to: 6b4b7d9acf60aa99d961b599f37d0c824be79e27\n> > > 9adb6b3971e7daa79221d7dbe05b66327b266b86\n> > ...\n> > > diff --git a/fetch-pack.c b/fetch-pack.c\n> > > index 3a903c4..57602b9 100644\n> > > --- a/fetch-pack.c\n> > > +++ b/fetch-pack.c\n> >\n> > Reverting just fetch-pack.c part of the patch helps.\n>\n> Could you please try the patch I sent with the subject \"[PATCH]\n> fetch/upload: Fix corner case with few revs\"? Your output looks exactly\n> like what I fixed with that patch.\n>\n\nI couldn't at the moment. Do you still need a test?\n"},{"id":"10646","messageId":"Pine.LNX.4.63.0510261041100.7424@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2197","inReplyTo":"81b0412b0510252346t3806892dx71f9c0dc1efe4073@mail.gmail.com","subject":"Re: [PATCH 4/4] git-fetch-pack: Implement client part of the multi_ack extension","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-10-26T08:41:47Z","receivedAt":"2005-10-26T08:41:47Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 26 Oct 2005, Alex Riesen wrote:\n\n> > Could you please try the patch I sent with the subject \"[PATCH]\n> > fetch/upload: Fix corner case with few revs\"? Your output looks exactly\n> > like what I fixed with that patch.\n> >\n> \n> I couldn't at the moment. Do you still need a test?\n\nIf you have time and can test it, yes, please.\n\nCiao,\nDscho\n"},{"id":"10651","messageId":"81b0412b0510260216s7571dba6w97163927a335818d@mail.gmail.com","threadId":"2197","inReplyTo":"Pine.LNX.4.63.0510261041100.7424@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH 4/4] git-fetch-pack: Implement client part of the multi_ack extension","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-10-26T09:16:15Z","receivedAt":"2005-10-26T09:16:15Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 10/26/05, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> > > Could you please try the patch I sent with the subject \"[PATCH]\n> > > fetch/upload: Fix corner case with few revs\"? Your output looks exactly\n> > > like what I fixed with that patch.\n> >\n> > I couldn't at the moment. Do you still need a test?\n>\n> If you have time and can test it, yes, please.\n>\n\nWill try. Which patch is it?\n"}]}