From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8145 invoked from network); 26 Dec 2021 01:34:56 -0000 Received: from 4ess.inri.net (216.126.196.42) by inbox.vuxu.org with ESMTPUTF8; 26 Dec 2021 01:34:56 -0000 Received: from mimir.eigenstate.org ([206.124.132.107]) by 4ess; Sat Dec 25 20:18:36 -0500 2021 Received: from abbatoir.myfiosgateway.com (pool-74-108-56-225.nycmny.fios.verizon.net [74.108.56.225]) by mimir.eigenstate.org (OpenSMTPD) with ESMTPSA id be75380f (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO) for <9front@9front.org>; Sat, 25 Dec 2021 17:11:37 -0800 (PST) Message-ID: To: 9front@9front.org Date: Sat, 25 Dec 2021 20:11:35 -0500 From: ori@eigenstate.org MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: lossless interface proxy API Subject: [9front] git: only send object ids once Reply-To: 9front@9front.org Precedence: bulk When fetching, we could send some object ids twice, if the same branch was pointing at the same object. This appears to tickle some issue in upstream git, making it fail to respect the fetch protocol, and sending multiple ack lines where it should send one. this change adds a set of objects we said we have, and we only send if we haven't already sent it. later, we will implement multi_ack. diff facb0e757ac63f763bd942a2714f979538b99eb0 uncommitted --- a/sys/src/cmd/git/fetch.c +++ b/sys/src/cmd/git/fetch.c @@ -186,6 +186,7 @@ int nref, refsz, first; int i, n, req, pfd; vlong packsz; + Objset hadobj; Object *o; nref = 0; @@ -246,13 +247,19 @@ req = 1; } flushpkt(c); + osinit(&hadobj); for(i = 0; i < nref; i++){ - if(hasheq(&have[i], &Zhash)) + if(hasheq(&have[i], &Zhash) || oshas(&hadobj, have[i])) continue; + if((o = readobject(have[i])) == nil) + sysfatal("missing object we should have: %H", have[i]); + osadd(&hadobj, o); + unref(o); n = snprint(buf, sizeof(buf), "have %H\n", have[i]); if(writepkt(c, buf, n + 1) == -1) sysfatal("could not send have for %H", have[i]); } + osclear(&hadobj); if(!req) flushpkt(c);