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

Multi-head fetch proposal

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Sep 29, 2005, 00:25 UTC
Message-ID
<Pine.LNX.4.63.0509290149540.19126@wgmdd8.biozentrum.uni-wuerzburg.de>
Hi,

I reported a while ago that a fetch downloaded objects which were already in the repository. While that was true, it was not the whole truth: This only happened with multi-head fetch.

As far as I can tell, what happened was this:
- fetch-pack connected to the server
- it asked correctly for the remote refs
- it then opened a (local) pipe to git-rev-list
- it sent quite a few refs from that pipe over the wire
- on the other side, upload-pack marked these refs as "fetcher got those"
- since upload-pack has a limit on that list (only 16) it soon said STFU 
- it turned out that quite a few common refs were not yet marked
- so upload-pack would upload these

The reason is that git-rev-list would happily output parents of refs which were already acknowledged by upload-pack to be common refs.

I just sent out a patch which makes this irrelevant for the case that most or all of these heads are already fetched.

Now, to really solve the multi-head problem, which really is the problem "how to find the edges of the common commits", I propose the following:

For each remote ref known to be not in the local repository, find the 1st, 2nd, 4th, 8th, ... parents. Send these to upload-pack to be marked. For each ack'ed ref (i.e. remote side also has it), do a binary search to find the edge (i.e. the youngest common ref) on that DAG branch.

(To ease the burden on the server side, one coul mark only the edges as stop gaps for upload-pack. However, it might make things too complicated.)

Of course, the trick is to do that asynchronously, so that the network bandwidth is used optimally. This means that not each ack'ed ref leads to a binary search, but only those refs where no descendant was ack'ed.

BTW this does not need any change of the protocol. In fact, it only needs a change to fetch-pack.

I'd also increase MAX_HAS in upload-pack.

Ciao, Dscho

Next: Junio C Hamano
Message 1 of 2 in “Multi-head fetch proposal”
  1. Johannes SchindelinSep 29, 2005
  2. Junio C HamanoSep 29, 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.