From: Shawn O. Pearce Date: Tue, 21 Jul 2009 15:28:00 GMT Subject: Re: [JGIT PATCH 05/11] Don't advertise HEAD from ReceivePack Message-ID: <20090721152800.GQ11191@spearce.org> In-Reply-To: <200907211722.09631.robin.rosenberg.lists@dewire.com> Robin Rosenberg wrote: > l?rdag 11 juli 2009 22:19:20 skrev "Shawn O. Pearce" : > > diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/ReceivePack.java b/org.spearce.jgit/src/org/spearce/jgit/transport/ReceivePack.java > > index fd8aa86..1c490af 100644 > > --- a/org.spearce.jgit/src/org/spearce/jgit/transport/ReceivePack.java > > +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/ReceivePack.java > > @@ -509,8 +509,11 @@ private void sendAdvertisedRefs() throws IOException { > > adv.advertiseCapability(CAPABILITY_REPORT_STATUS); > > if (allowOfsDelta) > > adv.advertiseCapability(CAPABILITY_OFS_DELTA); > > - refs = db.getAllRefs(); > > + refs = new HashMap(db.getAllRefs()); > > + final Ref head = refs.remove(Constants.HEAD); > > adv.send(refs.values()); > > + if (head != null && head.getName() == head.getOrigName()) > > + adv.advertiseHave(head.getObjectId()); > > This relies on an implicit guarantee that == works here. Would equals cost > too much? Or perhaps we should document this guarantee as part of the > interface. Ouch, good point, .equals would be better here. Can you amend? If its the only issue in the series just amend it to be .equals(), if there are other things for me to fix I'll be happy to send an updated patch. -- Shawn.