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

Re: [JGIT PATCH 05/11] Don't advertise HEAD from ReceivePack

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jul 21, 2009, 15:28 UTC
Message-ID
<20090721152800.GQ11191@spearce.org>
In-Reply-To
<200907211722.09631.robin.rosenberg.lists@dewire.com>
Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
Show 19 quoted lines
> l?rdag 11 juli 2009 22:19:20 skrev "Shawn O. Pearce" <spearce@spearce.org>:
> > 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<String, Ref>(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.
Previous: Robin Rosenberg
Message 14 of 14 in “Repository instance caching”
  1. 00/11 Repository instance cachingShawn O. Pearce, Jul 11, 2009
  2. 01/11 Change Daemon to use concurrent collections for exported repositoriesShawn O. Pearce, Jul 11, 2009
  3. 02/11 Make Daemon's exportAll check not require synchronizationShawn O. Pearce, Jul 11, 2009
  4. 03/11 Don't retry ".git" suffix in daemon if already triedShawn O. Pearce, Jul 11, 2009
  5. 04/11 Refactor ref advertisement code from server implementationsShawn O. Pearce, Jul 11, 2009
  6. 05/11 Don't advertise HEAD from ReceivePackShawn O. Pearce, Jul 11, 2009
  7. 06/11 Add a use reference counter to RepositoryShawn O. Pearce, Jul 11, 2009
  8. 07/11 Introduce RepositoryCache to cache handles of Repository objectsShawn O. Pearce, Jul 11, 2009
  9. 08/11 Change Daemon to use RepositoryCacheShawn O. Pearce, Jul 11, 2009
  10. 09/11 Expose the Repository's ObjectDatabase objectShawn O. Pearce, Jul 11, 2009
  11. 10/11 Use cached Repository instances when resolving alternatesShawn O. Pearce, Jul 11, 2009
  12. 11/11 Send .have lines in ReceivePack for alternate repositoriesShawn O. Pearce, Jul 11, 2009
  13. Robin RosenbergJul 21, 2009
  14. Shawn O. PearceJul 21, 2009

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.