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

Re: Errors cloning large repo

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 12, 2007, 14:24 UTC
Message-ID
<20070312142451.GC15150@spearce.org>
In-Reply-To
<200703121209.35052.jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> wrote:
> But what would happen if server supporting concatenated packfiles
> sends such stream to the old client? So I think some kind of protocol
> extension, or at least new request / new feature is needed for that.

No, a protocol extension is not required. The packfile format is: 12 byte header, objects, 20 byte SHA-1 footer. When sending concatenated packfiles to a client the server just needs to:

  - figure out how many objects total will be sent;
  - send its own (new) header with that count;
  - initialize a SHA-1 context and update it with the header;
  - for each packfile to be sent:
    - strip the first 12 bytes of the packfile;
    - send the remaining bytes, except the last 20;
    - update the SHA-1 context with the packfile data;
  - send its own footer with the SHA-1 context.
Very simple.  Even the oldest Git clients (pre multi-ack extension)
would understand that.  That's what's great about the way the
packfile protocol and disk format is organized.  ;-)
 
> Wouldn't it be better to pack loose objects into separate pack
> (and perhaps save it, if some threshold is crossed, and we have
> writing rights to repo), by the way?
Perhaps.  Interesting food for thought, something nobody has tried
to experiment with.  Currently servers pack to update the fetching
client.  That means they may be sending a mixture of already-packed
(older) objects and loose (newer) objects.  But with the new kept
pack thing in receive-pack its more likely that things are already
packed on the server, and not loose.  (I suspect most public open
source users are pushing >100 objects when they do push to their
server.)
 
Show 5 quoted lines
> > The client could easily segment that into multiple packfiles
> > locally using two rules:
> > 
> >   - if the last object was not a OBJ_COMMIT and this object is
> >   an OBJ_COMMIT, start a new packfile with this object.
...
> 
> Without first rule, wouldn't client end with strange packfile?
> Or would it have to rewrite a pack?

Nope. We don't care about the order of the objects in a packfile. Never have. Never will. Even in pack v4 where we have special object types that should only appear once in a packfile, they can appear at any position within the packfile. MUCH simpler code.

-- 
Shawn.
Previous: Jakub NarebskiNext: Jakub Narebski
Message 11 of 14 in “Re: Errors cloning large repo”
  1. Anton TropashkoMar 10, 2007
  2. Shawn O. PearceMar 10, 2007
  3. Linus TorvaldsMar 10, 2007
  4. Shawn O. PearceMar 10, 2007
  5. Martin WaitzMar 10, 2007
  6. Linus TorvaldsMar 10, 2007
  7. Martin WaitzMar 11, 2007
  8. Jakub NarebskiMar 10, 2007
  9. Shawn O. PearceMar 11, 2007
  10. Jakub NarebskiMar 12, 2007
  11. Shawn O. PearceMar 12, 2007
  12. Jakub NarebskiMar 17, 2007
  13. Linus TorvaldsMar 10, 2007
  14. Linus TorvaldsMar 10, 2007

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.