From: Junio C Hamano Date: Wed, 19 Oct 2005 23:09:37 GMT Subject: Re: [PATCH] Do not send "want" lines for complete objects Message-ID: <7vzmp5xfwu.fsf@assigned-by-dhcp.cox.net> In-Reply-To: Johannes Schindelin 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. > + 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.