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

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

From
Junio C Hamano <junkio@cox.net>
Date
Oct 19, 2005, 23:09 UTC
Message-ID
<7vzmp5xfwu.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.63.0510200004290.7689@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Also, git-fetch-pack does not have to ask for descendants of remote refs 
> which are complete (for now, git-rev-list is told to ignore only the first 
> parent).

I should interpret what you said with s/descendant/ancestor/ applied, I think. I would like to make sure I understand what you are doing here.

Show 7 quoted lines
> +		if (has_sha1_file(remote)
> +				&& parse_object(remote)->flags & COMPLETE) {
> +			if (rev_command_len + 44 < sizeof(rev_command)) {
> +				snprintf(rev_command + rev_command_len, 44,
> +					" ^%s^", sha1_to_hex(remote));
> +				rev_command_len += 43;
> +			}

This rev-list command is to generate the list of "have", and we learned that the other side says she has remote -- we choose not to tell her that we have ancestors of it, but we do tell her about the remote head itself.

Let's draw a single strand of pearl case to illustrate. You have a commit chain A->B->C->D, and the other end says she has C. At this point, telling her that you have C is enough, and by not telling her about A and B, you would save her from depreting MAX_HAVE slots. Of course, if the other end has D as another head, then the above logic would give "^D^" to rev-list as well, telling it not to tell her about C, but that is what we want -- because she already knows you have C too when you tell her that you have D. I think I like this optimization.

One thing that might help, when we are telling the other end about what we have, is an output ordering option to get-rev-list that shows not in chronological order, but in the order of distance from the tip. That may give the other end a better chance to find the latest (in commit order) common commit in each branch without running out is MAX_HAS buffer.

> 	NOTE: I'd rather have git-rev-list circumvented, so that 
> 	descendants of ack'ed objects are not sent via "have" lines.

I think since we do the traversal ourselves this may start to make more sense.

Previous: Johannes SchindelinNext: Junio C Hamano
Message 2 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.