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

Re: [PATCH] git-daemon server

From
Junio C Hamano <junkio@cox.net>
Date
Jun 3, 2005, 18:30 UTC
Message-ID
<7vmzq7l2cn.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vk6lbmk01.fsf@assigned-by-dhcp.cox.net>
>>>>> "JCH" == Junio C Hamano <junkio@cox.net> writes:
JCH> Looks very nice.  Some comments.

JCH> This being a dedicated GIT specific sync mechanism, you may want JCH> to give more smarts to the server, so that the client can say "I JCH> have these commits as HEADs in my forest, here are their SHA1s, JCH> now sync me up to the head you said you have whose SHA1 is JCH> this", implying he has all their HEADs dependents. Of course JCH> this can come later.

About the protocol, here is one change you may want to have even in the initial version to futureproof yourself, and let you make a "low hanging fruit" optimization without bumping the protocol version up.

Make "request" capable to optionally have this format:
	request <sha1> <commit-sha1> <ce-path>

Note. You have to make sure you have some way to quote embedded newlines in ce-path since your protocol is mostly line based.

When this optional form is used, the requestor is telling the responder the following:

    (1) it wants to retrieve <sha1>; this is the same as a
        request without the optional two fields.
    (2) it wants <sha1> because it is trying to complete a tree
        associated with <commit-sha1>; it already has the commit
        object itself and knows what the parents of the commit
        are.
    (3) it already has trees and blobs associated with all the
        parents of <commit-sha1>.
    (4) it knows that <sha1> resides at <ce-path> in the tree
        associated with <commit-sha1>.  As a special case, ""
        (an empty string) as <ce-path> means "the root level
        tree object associated with <commit-sha1>".

The initial implementation of a requestor does not even send this extended form. The initial implementation of a responder must be able to parse this extended form, but it does not have to do anything special about it; just do what your cmd_request() currently does. However, this extended request lets your later implementation of the responder create and send delta on the fly, by:

    (0) Look at <sha1> in the local storage.  If it is already
        deltified, do not do anything special but just send it
        out.
    (1) Look at <commit-sha1> and its parents.  Compare the
        object (either a blob or a tree) that corresponds to
        <ce-path> in the trees associated with these commits.
        Verify <sha1> is indeed what the requestor thinks it is
        while you are at it.
    (2) Try to synthesize a reasonable delta to create <sha1>
        based on the objects you find in step (1).  Upon finding
        a reasonable delta, send that as a delta object to the
        requestor.  Optionally you may want to replace the
        <sha1> found at the local store in step (0) with this
        delta.  If you have many parents, this "reasonable"
        delta does not necessarily have to be the minimal delta.

Unlike a full-blown "ihave/sendme" protocol extension, this does not require responder side to keep much client state, and should give you the ability to create and send a reasonable if not minimum delta lazily.

Hmm.
Previous: Junio C HamanoNext: Daniel Barkalow
Message 16 of 32 in “git-daemon server”
  1. git-daemon serverJason McMullan, Jun 3, 2005
  2. Linus TorvaldsJun 3, 2005
  3. McMullan, JasonJun 3, 2005
  4. Linus TorvaldsJun 3, 2005
  5. McMullan, JasonJun 3, 2005
  6. Linus TorvaldsJun 3, 2005
  7. McMullan, JasonJun 3, 2005
  8. Linus TorvaldsJun 3, 2005
  9. McMullan, JasonJun 3, 2005
  10. Linus TorvaldsJun 3, 2005
  11. Daniel SerpellJun 3, 2005
  12. Jason McMullanJun 5, 2005
  13. Junio C HamanoJun 3, 2005
  14. Linus TorvaldsJun 3, 2005
  15. Junio C HamanoJun 3, 2005
  16. Junio C HamanoJun 3, 2005
  17. Daniel BarkalowJun 3, 2005
  18. Linus TorvaldsJun 3, 2005
  19. Petr BaudisJun 3, 2005
  20. Daniel BarkalowJun 4, 2005
  21. Junio C HamanoJun 5, 2005
  22. Daniel BarkalowJun 5, 2005
  23. Junio C HamanoJun 5, 2005
  24. Daniel BarkalowJun 5, 2005
  25. Linus TorvaldsJun 5, 2005
  26. rename git-rpush and git-rpull to git-ssh-push and git-ssh-pullJunio C Hamano, Jun 5, 2005
  27. Daniel BarkalowJun 5, 2005
  28. Linus TorvaldsJun 5, 2005
  29. rename git-rpush and git-rpull to git-ssh-push and git-ssh-pullJunio C Hamano, Jun 5, 2005
  30. Linus TorvaldsJun 5, 2005
  31. Jason McMullanJun 5, 2005
  32. Linus TorvaldsJun 5, 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.