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

Re: Request for detailed documentation of git pack protocol

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 3, 2009, 02:11 UTC
Message-ID
<7vab4qdq2j.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20090603012940.GA3355@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> writes:
Show 28 quoted lines
> IIRC, without multi_ack, a client sends have lines in --date-order
> until the server has found a common base.  That means the client
> will send have lines that are already known by the server to be
> common, because they overlap in time with another branch that the
> server hasn't found a common base on yet.
>
> E.g. the client has things in caps that the server doesn't; server
> has things in lower case:
>
>      +---- u ---------------------- x
>     /             +----- y
>    /             /
>   a -- b -- c -- d -- E -- F
>    \
>     +--- Q -- R -- S
>
> If the client wants x,y and starts out by saying have F,S, the
> server doesn't know what F,S is.  Eventually the client says "have
> d" and the server sends "ACK d continue" to let the client know to
> stop walking down that line (so don't send c-b-a), but its not done
> yet, it needs a base for X.  The client keeps going with S-R-Q,
> until a gets reached, at which point the server has a clear base
> and it all ends.
>
> Without multi_ack the client would have sent that c-b-a chain anyway,
> interleaved with S-R-Q.
>
> Junio, am I right?
Correct.
Show 16 quoted lines
>> >>  * thin-pack
>> 
>> Server can send thin packs, i.e. packs which do not contain base 
>> elements, if those base elements are available on clients side.
>> Client has thin-pack capability when it understand how to "thicken"
>> them adding required delta bases making them independent.
>
> Yes.
>  
>> Of course it doesn't make sense for client to use (request) this
>> capability for git-clone.
>
> No, no it doesn't.  But if the client does request it (and I think
> modern clients actually do request it, even on initial clone case)
> the server won't produce a thin pack. Why?  There is no common base,
> so there is no uninteresting set to omit from the pack.  :-)
There also is "clone --reference".
> Actually, it has to be, because that "\n" isn't there on the first
> line when the capability data appears either wedged behind the "\0"
> or after the " " at the end of the line.
Correct.
> Its ugly.  But basically you keep a running counter of each "flush"
> sent, and then you send a "done" out, and then you wait until
> you have the right number of ACK/NAK answers back, and then the
> stream changes format.

One thing that I did not see mentioned in this thread is that the implementation is allowed to buffer non-flush packets and send multiple of them out with a single write(2). In other words, packet_write() could buffer instead of directly calling safe_write(), while packet_flush() must do safe_write() and make sure it drains.

Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 19 of 66 in “Request for detailed documentation of git pack protocol”
  1. Jakub NarebskiMay 12, 2009
  2. Shawn O. PearceMay 12, 2009
  3. Jakub NarebskiMay 14, 2009
  4. Shawn O. PearceMay 14, 2009
  5. Andreas EricssonMay 14, 2009
  6. Linus TorvaldsMay 15, 2009
  7. Clemens BuchacherMay 15, 2009
  8. Nicolas PitreMay 14, 2009
  9. Jakub NarebskiMay 14, 2009
  10. Scott ChaconMay 14, 2009
  11. Shawn O. PearceMay 14, 2009
  12. Jakub NarebskiMay 14, 2009
  13. A Large Angry SCMMay 15, 2009
  14. Ealdwulf WuffingaMay 15, 2009
  15. Jakub NarebskiJun 2, 2009
  16. Shawn O. PearceJun 2, 2009
  17. Jakub NarebskiJun 3, 2009
  18. Shawn O. PearceJun 3, 2009
  19. Junio C HamanoJun 3, 2009
  20. Shawn O. PearceJun 3, 2009
  21. Jakub NarebskiJun 3, 2009
  22. Shawn O. PearceJun 3, 2009
  23. Shawn O. PearceJun 3, 2009
  24. Jakub NarebskiJun 3, 2009
  25. Shawn O. PearceJun 3, 2009
  26. Jakub NarebskiJun 3, 2009
  27. Shawn O. PearceJun 3, 2009
  28. Jakub NarebskiJun 3, 2009
  29. Shawn O. PearceJun 3, 2009
  30. Jakub NarebskiJun 3, 2009
  31. Shawn O. PearceJun 3, 2009
  32. Junio C HamanoJun 3, 2009
  33. Jakub NarebskiJun 3, 2009
  34. Andreas EricssonJun 4, 2009
  35. Junio C HamanoJun 4, 2009
  36. Scott ChaconJun 6, 2009
  37. Junio C HamanoJun 6, 2009
  38. Jakub NarebskiJun 6, 2009
  39. Tony FinchJun 3, 2009
  40. Junio C HamanoJun 3, 2009
  41. Johannes SixtJun 3, 2009
  42. Robin H. JohnsonJun 3, 2009
  43. Jakub NarebskiJun 3, 2009
  44. Shawn O. PearceJun 3, 2009
  45. Tony FinchJun 3, 2009
  46. Jakub NarebskiJun 3, 2009
  47. Tony FinchJun 3, 2009
  48. Jakub NarebskiJun 4, 2009
  49. Tony FinchJun 4, 2009
  50. Shawn O. PearceJun 4, 2009
  51. Jakub NarebskiJun 3, 2009
  52. Shawn O. PearceJun 3, 2009
  53. Jakub NarebskiJun 4, 2009
  54. Shawn O. PearceJun 4, 2009
  55. Shawn O. PearceJun 5, 2009
  56. Jakub NarebskiJun 5, 2009
  57. Jakub NarebskiJun 5, 2009
  58. Comments pack protocol description in "Git Community Book" (second round)Jakub Narebski, Jun 6, 2009
  59. Scott ChaconJun 6, 2009
  60. Jakub NarebskiJun 7, 2009
  61. Shawn O. PearceJun 7, 2009
  62. Shawn O. PearceJun 7, 2009
  63. Jakub NarebskiJun 13, 2009
  64. Shawn O. PearceJun 7, 2009
  65. Jakub NarebskiJun 9, 2009
  66. Shawn O. PearceJun 9, 2009

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.