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

Re: [PATCH 5/6 (v2)] upload-pack: send the HEAD information

From
Jeff King <peff@peff.net>
Date
Dec 1, 2008, 17:44 UTC
Message-ID
<20081201174414.GA22185@coredump.intra.peff.net>
In-Reply-To
<1228140775-29212-6-git-send-email-gitster@pobox.com>
On Mon, Dec 01, 2008 at 06:12:54AM -0800, Junio C Hamano wrote:
> +			packet_write(1, "%s %s%c%s%c%s\n", sha1_to_hex(sha1), refname,
> +				     0, capabilities, 0, target);
Yuck. My two complaints are:
  (1) this implicitly handles only the HEAD symref. I don't think any
      others are in common use, but the rest of git handles arbitrary
      symrefs just fine. It would be a shame to needlessly limit the
      protocol. Can we at least make it <ref>:<ref> to allow later
      expansion to other symrefs?
      (1a) As a follow-on to that, because the client is not requesting
      anything, how would we ask for other symrefs if we want to do so
      later?  I think it would be nice to eventually allow copying of
      arbitrary symrefs within the refs/* hierarchy (e.g.,
      project-specific branch aliases). Sending all symrefs right off
      the bat is potentially large and wasteful.
  (2) You've used up the first such expansion slot forever. Now it's "if
      I want to tell you the symref, there is an extra slot, and
      otherwise none". But if we ever want to use the _next_ slot, then
      you will always have to send this slot (blank, I guess?). It gets
      even more complicated if you ever want to an arbitrary number of
      symref mappings. Maybe a short header to say "this slot contains a
      symref target"?
So (1) and (2) together would make it something like:
   <capabilities>\0
   symref HEAD:refs/heads/master\0
   symref refs/heads/alias:refs/heads/branch\n

which would make adding any new features in the expansion slots easier. But that still doesn't address (1a). I really like the other proposal a lot better.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 17 in “Detecting HEAD more reliably while cloning”
  1. 0/6 Detecting HEAD more reliably while cloningJunio C Hamano, Dec 1, 2008
  2. 1/6 get_remote_heads(): refactor code to read "server capabilities"Junio C Hamano, Dec 1, 2008
  3. 2/6 connect.c::read_extra_info(): prepare to receive more than server capabilitiesJunio C Hamano, Dec 1, 2008
  4. 3/6 connect.c::read_extra_info(): find where HEAD points atJunio C Hamano, Dec 1, 2008
  5. 4/6 clone: find the current branch more explicitlyJunio C Hamano, Dec 1, 2008
  6. 5/6 upload-pack: send the HEAD informationJunio C Hamano, Dec 1, 2008
  7. 6/6 clone: test the new HEAD detection logicJunio C Hamano, Dec 1, 2008
  8. Jakub NarebskiDec 1, 2008
  9. Shawn O. PearceDec 1, 2008
  10. Junio C HamanoDec 1, 2008
  11. Jeff KingDec 1, 2008
  12. Junio C HamanoDec 2, 2008
  13. Jeff KingDec 2, 2008
  14. Junio C HamanoDec 2, 2008
  15. Jeff KingDec 2, 2008
  16. Johannes SixtDec 1, 2008
  17. Junio C HamanoDec 2, 2008

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.