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

Re: [PATCH] Do not send "want" lines for complete objects

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Oct 21, 2005, 15:44 UTC
Message-ID
<Pine.LNX.4.64.0510211139590.25300@iabervon.org>
In-Reply-To
<Pine.LNX.4.63.0510210114370.10503@wbgn013.biozentrum.uni-wuerzburg.de>
On Fri, 21 Oct 2005, Johannes Schindelin wrote:
Show 21 quoted lines
> Hi,
> 
> On Thu, 20 Oct 2005, Daniel Barkalow wrote:
> 
> > On Thu, 20 Oct 2005, Johannes Schindelin wrote:
> > 
> > > Hi,
> > > 
> > > > > +		    ((o = parse_object(remote)) != NULL) &&
> > > > > +		    (o->flags & COMPLETE) &&
> > > 
> > > I just realized that parse_object() always reads the file, then does a 
> > > lookup (which makes the above code work), and then parses the file. It 
> > > always does all of these steps, even if the object was already parsed. Any 
> > > reason for this?
> > 
> > I'm lazy and haven't sent in a patch to clean that up. There's no reason 
> > it couldn't check whether the value it gets is already parsed.
> 
> Actually, you don't have to... Junio already replaced parse_object() by 
> lookup_object() in this case.

It often gets used in cases where it isn't completely obvious that the object has already been parsed; this is the second place that it's been replaced.

Show 6 quoted lines
> I did not use it originally, because lines 24-25 of commit.h say
> 
> 	/** Internal only **/
> 	struct object *lookup_object(const unsigned char *sha1);
> 
> Is this obsolete?

I'd intended it to be internal, for use by things like lookup_tree(), but I suppose that it could be used more generally, if it got a comment that says that, unlike lookup_tree() and such, it returns NULL if the object has not already been read (because it doesn't know how to create it).

	-Daniel
*This .sig left intentionally blank*
Previous: Junio C HamanoNext: Johannes Schindelin
Message 10 of 11 in “Do not send "want" lines for complete objects”
  1. Do not send "want" lines for complete objectsJohannes Schindelin, Oct 19, 2005
  2. Junio C HamanoOct 19, 2005
  3. Junio C HamanoOct 20, 2005
  4. Johannes SchindelinOct 20, 2005
  5. Johannes SchindelinOct 20, 2005
  6. Junio C HamanoOct 20, 2005
  7. Daniel BarkalowOct 20, 2005
  8. Johannes SchindelinOct 20, 2005
  9. Junio C HamanoOct 21, 2005
  10. Daniel BarkalowOct 21, 2005
  11. Johannes SchindelinOct 20, 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.